I'm trying to pass in a variable like @sort and select out of a temp table
and order by that variable. I can't get this to work no matter what
combination of quotes and concationations I use. Any help is greaty
appreciated. I'm lost.
@sort varchar(50)
SET @sort = 'lname'
--bunch of joins and selects here dumped into #extreturn
-- my last attempt
exec ("Select * from #ExtReturn order by'"+ @sort+"'")
this works fine:
exec ("Select * from #ExtReturn order by Lname)
Thanks,
Doug
______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community. http://www.fusionauthority.com/ads.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists