显示标签为“quot”的博文。显示所有博文
显示标签为“quot”的博文。显示所有博文

2012年3月22日星期四

BCP QUERYOUT from a procedure?

Anyone ever BCP QUERYOUT from a stored procedure?

Something like this? Is this even possible?

BCP "exec usp_MyProc 1, N'SomeString'" QUERYOUT c:\Output.txt -SMyServer -T -N

Did you try it before posting the question? It worked for me.

|||Sure. We do this all the times.|||

Yep. I did. No luck.

It works if I do this:

Code Snippet

bcp "declare @.str nvarchar(255); set @.str = N'SomeVar'; exec usp_MyProc 1, @.str" ...

something odd there...hmm...

|||

Works for me like this.

bcp "exec db4.dbo.get_employee 1" queryout c:\emp.txt -SSankar-P -T -c

sql

2012年3月8日星期四

bcp failed when special characters {;" were used in the password from command line in Win 2

bcp worked with password in normal characters, but failed with {;"

I tried for SQL 2005 and SQL 2000, from Window 2003 SP1. Is this a bug?

When the special character { was used in the password, bcp failed with Native error 0.

>>

F:\ftp\log\Cases>bcp "sem5.sem5.server_system_log_1" in server_system_log_1.dat
-n -Smodonald -Usem5 -P{
SQLState = 08001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Neither DSN nor SERVER keyword supplied
SQLState = 01S00, NativeError = 0
Warning = [Microsoft][ODBC SQL Server Driver]Invalid connection string attribute
>>

When the special character ; or " was used in the password, bcp failed with Native error 18456.

>>

F:\ftp\log\Cases>bcp "sem5.sem5.server_system_log_1" in server_system_log_1.dat
-n -Smodonald -Usem5 -P;
SQLState = 28000, NativeError = 18456
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'sem5'.

F:\ftp\log\Cases>bcp "sem5.sem5.server_system_log_1" in server_system_log_1.dat
-n -Smodonald -Usem5 -P"
SQLState = 28000, NativeError = 18456
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'sem5'.
>>

Could you try :

bcp "sem5.sem5.server_system_log_1" in server_system_log_1.dat
-n -Smodonald -Usem5 -P"{"|||

I tried the followings but it didn't work.

bcp "sem5.sem5.server_system_log_1" in server_system_log_1.dat
-n -Smodonald -Usem5 -P"{"

bcp "sem5.sem5.server_system_log_1" in server_system_log_1.dat
-n -Smodonald -Usem5 -P'{'

bcp "sem5.sem5.server_system_log_1" in server_system_log_1.dat
-n -Smodonald -Usem5 -P\{


|||Please try {{} for pwd {|||

I opened a case and got an answer.

Based on the Microsoft SQL Server 2005 online help for “Strong Passwords[SQL Server]”,

>>

if used in an OLE DB or ODBC connection string, a login or password must not contain the following characters: [] {}() , ; ? * ! @.. These characters are used to either initialize the connection or separate connection values.

>>

As the result, SQL Server Enterprise Manager allows all special characters but the OLE DB or ODBC connection is different.

|||

Thanks for following up your own post. It helps others when you share your solution.

2012年2月16日星期四

BC30260 Error

I am getting this error that says "Natvie compiler return value [BC30260] 'EH_PID is declared as 'Class EH_PID' in this class."

Does anyone know what this means and how I can fix it?

Nevermind, for some reason when I changed the name of the Dataset it works fine.