Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

How to use cross apply with openquery (tvf)?

$
0
0

Experts,

I was trying to do something like this,

SELECT	TOP 1
		r.Address1, r.Address2, '', r.City,	r.State, r.Zip
FROM	table_name a
CROSS APPLY
		(
			SELECT	*
			FROM	OPENQUERY(linkedserver,
						'SELECT	*
						 FROM	ufn_name ( ''LTRIM(RTRIM(a.ADDRESS1))'', ''LTRIM(RTRIM(a.ADDRESS2))'',
										   '''', ''LTRIM(RTRIM(a.CITY))'', ''LTRIM(RTRIM(a.STATE))'',
										   ''LTRIM(RTRIM(a.ZIPCODE))'', 1)'
							 )
		) r
ORDER BY LTRIM(RTRIM(a.ZIPCODE))

Please help me out?

Thanks

Kumar


Please do let us know your feedback. Thank You - KG, MCTS



Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>