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 |
|
sqldev6
Starting Member
18 Posts |
Posted - 2008-06-02 : 10:54:46
|
| Hello, I need to create a stored procedure that creates a csv file. this is the code I have so far. Script is like CREATE PROCEDURE dbo.GetQuestionInfoCSV ASBEGINdeclare @sql varchar(8000)SET @sql = 'bcp "SELECT * FROM dbo.ISO_table" queryout C:\GetCSV.CSV -c -t, -T -S MANCHEST\SQLEXPRESS'print @sqlEXEC master..xp_cmdshell @sqlENDand I get these errors on executionSQLState = 42S02, NativeError = 208Error = [Microsoft][SQL Native Client][SQL Server]Invalid object name 'dbo.ISO_table'.SQLState = 42000, NativeError = 8180Error = [Microsoft][SQL Native Client][SQL Server]Statement(s) could not be prepared.NULLAny help would much appreciated. |
|
|
sqldev6
Starting Member
18 Posts |
Posted - 2008-06-02 : 11:03:37
|
| I got it.I am not specifing database name anywhere in my code.If we not specifing any db name it will look into the default database of that user.Thats why its giving that error. invalid object error.Thanks..........:) |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-02 : 11:16:15
|
quote: Originally posted by sqldev6 I got it.I am not specifing database name anywhere in my code.If we not specifing any db name it will look into the default database of that user.Thats why its giving that error. invalid object error.Thanks..........:)
Thanks for posting the solution too. This will certainly be of help to someone in future. |
 |
|
|
|
|
|