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.
Author |
Topic |
pascal_jimi
Posting Yak Master
167 Posts |
Posted - 2013-06-06 : 08:33:47
|
how to I create stored procedure for bulk insertbulk insert mytablefrom '@ggg'with(formatfile='c:\temp\lll.txt')kmkmmm |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-06-06 : 10:40:46
|
you need dynamic sql for thatCREATE PROC BulkInsertData@ggg varchar(1000)ASDECLARE @SQL varchar(3000)SET @SQL = 'bulk insert mytablefrom ''' + @ggg + '''with(formatfile=''c:\temp\lll.txt'')'EXEC(@SQL)GO ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
pascal_jimi
Posting Yak Master
167 Posts |
Posted - 2013-06-06 : 10:54:52
|
thank you but EXECUTE BulkInsertData('C:\temp\abseron060400.txt')-----------errorLine 1: Incorrect syntax near 'C:\temp\abseron060400.txt'.kmkmmm |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2013-06-06 : 21:44:24
|
quote: Originally posted by pascal_jimi thank you but EXECUTE BulkInsertData('C:\temp\abseron060400.txt')-----------errorLine 1: Incorrect syntax near 'C:\temp\abseron060400.txt'.kmkmmm
EXECUTE BulkInsertData 'C:\temp\abseron060400.txt'OREXECUTE BulkInsertData @ggg = 'C:\temp\abseron060400.txt' KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|