Import Text File into Sql Server 2000
-
hi Mubashir, its not clear what kind of process would u like to proceed. assuming you want to insert the data into table from file.try using BULK INSERT statement available on sql server2000. If you want to exec a select query stored in a text file there is no straight method to procede. i've manipulated some different approach for that, assuming you have entere some "select * from Products" in a text file called test.txt. the steps involved are as, Declare @cmd varchar(100) Declare @sqlcmd varchar(2000) set @cmd = 'type e:\test.txt' CREATE TABLE #temptable (id int identity(1,1), string VARCHAR(4000)) Insert #temptable exec master..xp_cmdshell @cmd Declare @Max int, @Min int select @sqlcmd=string from #temptable Drop Table #temptable Exec(@sqlcmd) stay smart