Solved

Format File Creation

Posted on 2009-06-29
6
206 Views
Last Modified: 2013-11-10
HI Experts,

Accodring to this example: http://www.databasejournal.com/features/mssql/article.php/3663631/SQL-Server-2005-Integration-Services---Part-45---Bulk-Insert-Task-and-Format-Files.htm

to get the xml  format file you use this bcp cmd:

bcp AdventureWorks.HumanResources.myTeam format nul -c -t , -f myTeam.XML -x -T

However, encountered this error:

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

Same goes for :

bcp AdventureWorks.HumanResources.myTeam format nul -c -t , -f myTeam.Fmt -T

Any ideas?
0
Comment
Question by:allanau20
  • 5
6 Comments
 
LVL 15

Accepted Solution

by:
MohammedU earned 500 total points
ID: 24740590
From where you are running the bcp command?
If you have not tried from command window then try it...
0
 
LVL 5

Author Comment

by:allanau20
ID: 24741174
oh, I tried it in Management Studio.
When I ran the script above I cannot find the file on my puter. Even tried local drive and network folder, but no see fmt file.
Do you know where the file is?

TIA!
0
 
LVL 5

Author Comment

by:allanau20
ID: 24741185
actually, i got this err:

C:\Data>bcp AdventureWorks.HumanResources.myTeam format nul -c -t , -f c:\data\m
yTeam.Fmt -T
SQLState = 08001, NativeError = 17
Error = [Microsoft][ODBC SQL Server Driver][Shared Memory]SQL Server does not ex
ist or access denied.
SQLState = 01000, NativeError = 2
Warning = [Microsoft][ODBC SQL Server Driver][Shared Memory]ConnectionOpen (Conn
ect()).

Researching ...
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 5

Author Comment

by:allanau20
ID: 24741522
Here's what I've tried:

bcp [MyWorkstation\MyLocalDB].AdventureWorks.HumanResources.myTeam format nul -c -t , -f \\MyWorkstation\c$\data\myTeam.Fmt -T

bcp [MyWorkstation\MyLocalDB].AdventureWorks.HumanResources.myTeam format nul -c -t , -f C:\data\myTeam.Fmt -T

bcp AdventureWorks.HumanResources.myTeam format nul -c -t , -f C:\data\myTeam.Fmt -T

bcp
[MyWorkstation\MyLocalDB].AdventureWorks.HumanResources.myTeam format nul -c -t , -f \\SomeServer\SomeFolder\myTeam.Fmt -T

And still get this err:

SQLState = 08001, NativeError = 17
Error = [Microsoft][ODBC SQL Server Driver][Shared Memory]SQL Server does not ex
ist or access denied.
SQLState = 01000, NativeError = 2
Warning = [Microsoft][ODBC SQL Server Driver][Shared Memory]ConnectionOpen (Conn
ect()).
0
 
LVL 5

Author Comment

by:allanau20
ID: 24748612
I think I know what the issue is and it has do with Win Authen.
Can't even run this: osql -E -SYour_target_machine\Your_instance





0
 
LVL 5

Author Closing Comment

by:allanau20
ID: 31598125
Thanks for trying to help!
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question