English 中文(简体)
用纸面板书写纸张
原标题:writing a text from a table using tsql

我正试图从表格中撰写一份产出文件。 我没有发现任何错误,但档案没有制作。

 EXEC master..xp_cmdshell  bcp "SELECT * FROM DB.dbo.table1" queryout "C:employee.txt" -T -Sservername -U user111 -P pwd -c -t, 

我不清楚为什么没有立案。 谁能帮助?

I am not getting errors instead I get following messages:

usage: bcp {dbtable | query} {in | out | queryout | format} datafile
 [-m maxerrors]            [-f formatfile]          [-e errfile]
 [-n native type]          [-c character type]      [-w wide character type]
[-N keep non-text native] [-V file format version] [-q quoted identifier]
  [-C code page specifier]  [-t field terminator]    [-r row terminator]



[-i inputfile]            [-o outfile]             [-a packetsize]

[-S server name]          [-U username]            [-P password]
[-T trusted connection]   [-v version]             [-R regional enable]
[-k keep null values]     [-E keep identity values]
  NULL

我在服务器A上运行,但数据库在服务器B上,例如服务器A I SERVER管理演播室,并给服务器B细节登录。 在我提出上述问题之后,我提出了问题。 因此,将建立哪一个服务器?

最佳回答

问题正确:

EXEC master..xp_cmdshell  bcp "SELECT * FROM DB.dbo.table1" queryout "C:employee.txt" 

- 服务器名称——Uuser111 -P pwd -c -t

while typing in SQL SERVER MANAGEMENT studio I pressed enter after queryout so statement "C:employee.txt" - 服务器名称——Uuser111 -P pwd -c -t was coming in next line. because of this I was not getting any error or

问题回答

甚至在用户名和通行证之后,就与我合作或没有空间。 您是否可读到C:在服务器箱上? 如果你也使用——T?

http://msdn.microsoft.com/en-us/library/ms162802.aspx” rel=“nofollow noreferer”题目=“bcp Utility” MSDN:

<>安全说明>

bcp公用事业与服务器连接时,使用-T选项(连接<>><>><>>><>>而不是<>>>。 user name and passwordjoint.





相关问题
How to write this T-SQL WHERE condition?

I ve got two tables: TableA Col1 Col2 TableB Col3 Col4 I want to join them together: SELECT * from TableA join TableB ON (...) Now, in place of ... I need to write an expression ...

Customer and Order Sql Statement

TSQL query to select all records from Customer that has an Order and also select all records from customer that does not have an Order. The table Customer contains a primary key of CustomerID. The ...

Recommended way of querying multiple Versioned tables

Have a win 2003 box with MSSQL 2005 running on it. There is a database which is populated every morning with new/modified SalesOrder made the previous day. The database has several tables: SalesOrder, ...

update duplicate record

I have a table with the following fields Id Name IsPublic i need to write a sql query that updates IsPublic to false where name has a duplicate. Only one of the duplicates should have IsPublic = ...

Define variable to use with IN operator (T-SQL)

I have a Transact-SQL query that uses the IN operator. Something like this: select * from myTable where myColumn in (1,2,3,4) Is there a way to define a variable to hold the entire list "(1,2,3,4)"? ...

Selecting records during recursive stored procedure

I ve got a content management system that contains a hierarchical structure of categories, with sub-categories subject to different ordering options at each level. Currently, that s retrieved by a (...

热门标签