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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Select with where clause

Author  Topic 

rkalyani
Starting Member

30 Posts

Posted - 2009-06-15 : 15:20:27
I need to do a select against a field created by

select * from tbl1 where created_by in('Smith, Kevin, 'Ring, Ryan')

but the values in created_by are stored like this Kevin Smith, Ryan Ring.

So how do I take my created_by and reverse it to look like Smith, Kevin.



Thank you,
kal30

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-15 : 15:23:18
How is the WHERE part built in the first place?
Is it dynamically built from the application?


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

rkalyani
Starting Member

30 Posts

Posted - 2009-06-15 : 15:33:25
No it is in a query but the name is got from a report parameter.

Thank you,
kal30
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-15 : 15:36:26
Dynamically built, then...
Any chance you can alter the drop down list to present the names in other order?


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

rkalyani
Starting Member

30 Posts

Posted - 2009-06-15 : 15:40:28
I have two set of queries and both matches different tables. One query needs it like this 'Smith, kevin' and the other needs it
like this 'Kevin Smith'

So I was wondering if I could change one of that .

Thank you,
kal30
Go to Top of Page
   

- Advertisement -