When trying to export from SQL to a file using the following:
------------
DECLARE @.FileName varchar(50),
@.bcpCommand varchar(2000)
SET @.FileName =
REPLACE('c:\tmp\tblComponentType_'+CONVERT(char(8) ,GETDATE(),1)+'.txt','/','
-')
SET @.bcpCommand = 'bcp "SELECT * FROM PNP..tblComponentType" queryout "'
SET @.bcpCommand = @.bcpCommand + @.FileName + '" -U pnpadmin -P admin -c'
EXEC master..xp_cmdshell @.bcpCommand
-------------
SQL Server gives me this error:
------------
SQLState = 08001, NativeError = 17
Error = [Microsoft][ODBC SQL Server Driver][Shared Memory]SQL Server does
not exist or access denied.
SQLState = 01000, NativeError = 2
Warning = [Microsoft][ODBC SQL Server Driver][Shared Memory]ConnectionOpen
(Connect()).
NULL
------------
I've given the user datareader/writer permissions, also permission to SELECT
from that table. I get the feeling I need to qualify the SQL Server name
somehow.
Many thanks,
PaulDECLARE @.FileName varchar(50),
@.bcpCommand varchar(2000)
SET @.FileName =
REPLACE('c:\tmp\tblComponentType_'+CONVERT(char(8) ,GETDATE(),1)+'.txt','/','
-')
SET @.bcpCommand = 'bcp "SELECT * FROM PNP..tblComponentType" queryout "'
SET @.bcpCommand = @.bcpCommand + @.FileName + '" -U pnpadmin -P admin -c' +
'-S'+@.@.servername
EXEC master..xp_cmdshell @.bcpCommand
--
-oj
RAC v2.2 & QALite!
http://www.rac4sql.net
"Paul Sampson" <psampson@.uecomm.com.au> wrote in message
news:1063168972.776810@.proxy.uecomm.net.au...
> Hi, I'm hoping someone can help me
> When trying to export from SQL to a file using the following:
> ------------
> DECLARE @.FileName varchar(50),
> @.bcpCommand varchar(2000)
> SET @.FileName =
REPLACE('c:\tmp\tblComponentType_'+CONVERT(char(8) ,GETDATE(),1)+'.txt','/','
> -')
> SET @.bcpCommand = 'bcp "SELECT * FROM PNP..tblComponentType" queryout "'
> SET @.bcpCommand = @.bcpCommand + @.FileName + '" -U pnpadmin -P admin -c'
> EXEC master..xp_cmdshell @.bcpCommand
> -------------
> SQL Server gives me this error:
> ------------
> SQLState = 08001, NativeError = 17
> Error = [Microsoft][ODBC SQL Server Driver][Shared Memory]SQL Server does
> not exist or access denied.
> SQLState = 01000, NativeError = 2
> Warning = [Microsoft][ODBC SQL Server Driver][Shared Memory]ConnectionOpen
> (Connect()).
> NULL
> ------------
> I've given the user datareader/writer permissions, also permission to
SELECT
> from that table. I get the feeling I need to qualify the SQL Server name
> somehow.
> Many thanks,
> Paul|||Thanks!
"oj" <nospam_ojngo@.home.com> wrote in message
news:Hhy7b.18455$mp.11900@.rwcrnsc51.ops.asp.att.ne t...
> DECLARE @.FileName varchar(50),
> @.bcpCommand varchar(2000)
> SET @.FileName =
REPLACE('c:\tmp\tblComponentType_'+CONVERT(char(8) ,GETDATE(),1)+'.txt','/','
> -')
> SET @.bcpCommand = 'bcp "SELECT * FROM PNP..tblComponentType" queryout "'
> SET @.bcpCommand = @.bcpCommand + @.FileName + '" -U pnpadmin -P admin -c' +
> '-S'+@.@.servername
> EXEC master..xp_cmdshell @.bcpCommand
> --
> -oj
> RAC v2.2 & QALite!
> http://www.rac4sql.net
>
> "Paul Sampson" <psampson@.uecomm.com.au> wrote in message
> news:1063168972.776810@.proxy.uecomm.net.au...
> > Hi, I'm hoping someone can help me
> > When trying to export from SQL to a file using the following:
> > ------------
> > DECLARE @.FileName varchar(50),
> > @.bcpCommand varchar(2000)
> > SET @.FileName =
REPLACE('c:\tmp\tblComponentType_'+CONVERT(char(8) ,GETDATE(),1)+'.txt','/','
> > -')
> > SET @.bcpCommand = 'bcp "SELECT * FROM PNP..tblComponentType" queryout "'
> > SET @.bcpCommand = @.bcpCommand + @.FileName + '" -U pnpadmin -P admin -c'
> > EXEC master..xp_cmdshell @.bcpCommand
> > -------------
> > SQL Server gives me this error:
> > ------------
> > SQLState = 08001, NativeError = 17
> > Error = [Microsoft][ODBC SQL Server Driver][Shared Memory]SQL Server
does
> > not exist or access denied.
> > SQLState = 01000, NativeError = 2
> > Warning = [Microsoft][ODBC SQL Server Driver][Shared
Memory]ConnectionOpen
> > (Connect()).
> > NULL
> > ------------
> > I've given the user datareader/writer permissions, also permission to
> SELECT
> > from that table. I get the feeling I need to qualify the SQL Server name
> > somehow.
> > Many thanks,
> > Paul
没有评论:
发表评论