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)
 Text input to SQL Query

Author  Topic 

jocol
Starting Member

1 Post

Posted - 2009-11-09 : 12:00:26
Is there a way to use the contents of a text file as the input to a SQL query. Text file contains user id's (25 of them on a seperate rows). I want to read the text file and build a query similar to the following:
select * from DATABASE where userid in = ( 'first userid', 'second userid', third userid')

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-11-09 : 12:03:27
you need to use OPENROWSET for this

http://blogs.msdn.com/sqlserverstorageengine/archive/2006/05/30/Preprocessing-data-before-bulk-import.aspx
Go to Top of Page
   

- Advertisement -