Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to include ascin dynamic sql

Author  Topic 

sqllover
Constraint Violating Yak Guru

338 Posts

Posted - 2007-03-01 : 04:28:55
how to include asc near order by

select @sql= ' select u.userid,u.user_name, u.password, c.code_description as role_code,u.expiry_date,u.created_date,u.active from [usermaster] u inner join [codeMaster] c
on u.role_code=c.code where u.' + @columnname + ' like ''' + @recordname + '%'' order by u.' + @columnname

nr
SQLTeam MVY

12543 Posts

Posted - 2007-03-01 : 04:43:02
order by u.' + @columnname + ' asc'

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-03-01 : 05:55:23
No need to add ASC specifically, it is by default.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

sqllover
Constraint Violating Yak Guru

338 Posts

Posted - 2007-03-01 : 06:12:28
hi harsh and nr thanks i have done that.
Go to Top of Page
   

- Advertisement -