Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 12th, 2003, 03:59 AM
Authorized User
 
Join Date: Sep 2003
Location: Faridabad, haryana, India.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to devrishi
Default Using bcp Utility in SQL

hi,

When we use bcp over SQL Data to transfer data to text file, it is giving me Date in Reverse order (Year-Month-Date). Visual Foxpro finds it difficult to convert it into date field.

Is there any way out to convert the date or any other way I can use 'bcp utility' so that it gives me Dates in dd/mm/yyyy format.

Please help. Its urgent.

Regards

Devrishi

Reply With Quote
  #2 (permalink)  
Old November 13th, 2003, 03:01 AM
Registered User
 
Join Date: Nov 2003
Location: , , Australia.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How about converting the date field within the query? Something like this should work:

Code:
SELECT *, CONVERT(CHAR(10), DateField, 103) FROM tblTable
Cheers,
Brendan.

Reply With Quote
  #3 (permalink)  
Old November 13th, 2003, 05:07 AM
Authorized User
 
Join Date: Sep 2003
Location: Faridabad, haryana, India.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to devrishi
Default

hi Brendan,

thanks for ur help. It works. but I'm using bcp (bulk copy) utility. Is there any way in which I can convert datetime field in bcp?


Regards

Devrishi

Reply With Quote
  #4 (permalink)  
Old November 24th, 2004, 03:43 AM
Registered User
 
Join Date: Nov 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Devrishi

What Brendan means (I believe) is to use the queryout flag in BCP.

Ie. BCP "SELECT TOP 10 * FROM Pubs..tblTable" queryout -c -E -Usa -Ppassword -SServername

Substitute the SQL for whatever you want (function or not) to get the format you desire.

Hope this helps.

Gary


Reply With Quote
  #5 (permalink)  
Old November 24th, 2004, 03:47 AM
Registered User
 
Join Date: Nov 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oops.

Missed out the target text File.

How about this instead.

Ie. BCP "SELECT *, CONVERT(CHAR(10), DateField, 103) FROM tblTable" queryout Text.txt -c -E -Usa -Ppassword -SServername

Gary

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Query output to XML using BCP HELP!! miamikk SQL Language 3 May 15th, 2009 08:22 AM
Alternative of BCP Utility to update Database rajnikantbal C# 3 January 16th, 2008 12:46 PM
txt file generated from SQl BCP nidhigarg9 SQL Server 2000 1 June 16th, 2006 02:16 PM
Cool utility Yurko SQL Server 2000 3 December 2nd, 2005 11:03 AM
Bcp utility jejyjose SQL Server 2000 1 October 16th, 2003 08:31 AM



All times are GMT -4. The time now is 02:34 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.