Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 5th, 2003, 10:46 PM
msilva msilva is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 2 msilva User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Where In()

I need a select statement that will bring me a range of selection data.

SELECT * FROM Languages
WHERE LanguageId In (@LanguageId)
Order By LanguageName

Can the in condition be passed as a parameter
The parameter will be "it,pt-br,es,de-de"
If not how can a Get the same result.

Thanks

Reply With Quote
  #2  
Old August 6th, 2003, 09:33 AM
rdoekes rdoekes is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Strasbourg, France
Posts: 181 rdoekes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 20 sec
Reputation Power: 7
Send a message via AIM to rdoekes Send a message via Yahoo to rdoekes
dynamic SQL?

You can always opt for dynamic sql:
Code:
DECLARE @sql nvarchar(500)
DECLARE @LanguageId nvarchar(100)

SET @LanguadeId = 'it,pt-br,es,de-de'

SET @sql = N'SELECT * FROM Languages' + CHAR(13) +
N'WHERE LanguageId In (' + @LanguageId + N') ' + CHAR(13) +
N'Order By LanguageName'

Execute sp_executesql @sql
__________________
- Rogier Doekes

Reply With Quote
  #3  
Old August 6th, 2003, 12:59 PM
msilva msilva is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 2 msilva User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thank you worked, if I pass

'it','pt-br','es','de-de'

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > Where In()


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT