Showing posts with label dbo. Show all posts
Showing posts with label dbo. Show all posts

Monday, March 26, 2012

Help for bcp command for export data to txt file

I have follow the syntax to export table to .txt file like this.

bcp UL.dbo.CFP OUT C:\a.txt -T -c -S NOTEBOOK-F47731

But it always show error which is:

Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '.'.

I have try it many time. Can anyone help me to solve this problem?

Sorry if this is a simplistic answer, but have you tried putting single quotes around your query like so...

'bcp UL.dbo.CFP OUT C:\a.txt -T -c -S NOTEBOOK-F47731'

Here's how I'm using bcp at the moment.

USE MYDATABASE
GO

DECLARE @.LINE_ITEM_DATA SYSNAME
SET @.LINE_ITEM_DATA = 'bcp MYDATABASE.LINE_ITEM_DETAIL OUT c:\LineItemData.txt -T -c -t ","'
EXEC XP_CMDSHELL @.LINE_ITEM_DATA, NO_OUTPUT

Hope that helps!

Wednesday, March 21, 2012

Help again

Ok I was able to create a view through the GamingCommissiondb for all the other tables in the LicensingActions.dbo except for this table can someone help me our here?My first guess would be a typo.

After that, a permissions problem.

Then things start to get interesting!

-PatP