Solved

Format File Creation

Posted on 2009-06-29
6
201 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now