Click here to Skip to main content
15,922,584 members
Home / Discussions / Database
   

Database

 
GeneralRe: Save Image in SQL Database Pin
Wendelius30-Aug-08 6:04
mentorWendelius30-Aug-08 6:04 
GeneralRe: Save Image in SQL Database Pin
bapu288930-Aug-08 6:13
bapu288930-Aug-08 6:13 
GeneralRe: Save Image in SQL Database Pin
Wendelius30-Aug-08 6:21
mentorWendelius30-Aug-08 6:21 
GeneralRe: Save Image in SQL Database Pin
bapu288930-Aug-08 6:34
bapu288930-Aug-08 6:34 
GeneralRe: Save Image in SQL Database Pin
Wendelius30-Aug-08 6:48
mentorWendelius30-Aug-08 6:48 
GeneralRe: Save Image in SQL Database Pin
bapu28896-Sep-08 4:50
bapu28896-Sep-08 4:50 
GeneralRe: Save Image in SQL Database Pin
Wendelius6-Sep-08 7:56
mentorWendelius6-Sep-08 7:56 
QuestionDate Format in BCP bulk export Pin
Ariel Kazeed28-Aug-08 0:49
Ariel Kazeed28-Aug-08 0:49 
Hello everyone,

I'm using bcp.exe to export some data from an SQL Server 2005 database to a txt file that can be used in some other old unix system.

Thing is, once the export is done, exported rows look like this:

0730280001868       38         20040005232004-03-24 00:00:00.0002004-04-19 00:00:00.000


Dates are in a yyyy-MM-dd hh:mm:ss.sss format. However, I need datetime values to get exported in a dd/MM/year format.

According to documentation in MSDN, format in bcp import/export operations is done through a format file (an xml file in this case), so any change in the format should be done by modifying this file. Currently, my format file looks like this:

<?xml version="1.0"?>
<BCPFORMAT xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <RECORD>
  <FIELD ID="1" xsi:type="CharFixed" LENGTH="20" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
  <FIELD ID="2" xsi:type="CharFixed" LENGTH="11" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
  <FIELD ID="3" xsi:type="CharFixed" LENGTH="10" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
  <FIELD ID="4" xsi:type="CharFixed" LENGTH="8" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
  <FIELD ID="5" xsi:type="CharTerm" TERMINATOR="\r\n" MAX_LENGTH="8" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
 </RECORD>
 <ROW>
  <COLUMN SOURCE="1" NAME="POL_NumPoliza" xsi:type="SQLVARYCHAR"/>
  <COLUMN SOURCE="2" NAME="CIA_Id" xsi:type="SQLINT"/>
  <COLUMN SOURCE="3" NAME="SIN_Alias" xsi:type="SQLVARYCHAR"/>
  <COLUMN SOURCE="4" NAME="SIN_FechaSiniestro" xsi:type="SQLVARYCHAR" LENGTH="8"/>
  <COLUMN SOURCE="5" NAME="SIN_FechaParte" xsi:type="SQLVARYCHAR" LENGTH="8"/>
 </ROW>
</BCPFORMAT>


Considering I've changed almost everything that can be changed in that file [datatypes, collations, lengths etc], my question is, does anyone have an idea on how to force bcp to write datetime values in a particular format (just like using FORMAT!) when writing the text file?

Thanks in advance !

Kazz


"Users are there to click on things, not think. Let the archs do the damn thinking."

AnswerRe: Date Format in BCP bulk export Pin
Wendelius28-Aug-08 4:41
mentorWendelius28-Aug-08 4:41 
Question"Neat-a-fying" a huge query [modified] Pin
MatthysDT27-Aug-08 23:15
MatthysDT27-Aug-08 23:15 
AnswerRe: "Neat-a-fying" a huge query Pin
Wendelius27-Aug-08 23:58
mentorWendelius27-Aug-08 23:58 
AnswerRe: "Neat-a-fying" a huge query Pin
TheFM23428-Aug-08 16:52
TheFM23428-Aug-08 16:52 
Questionremove commas in a column in mssql Pin
phokojoe27-Aug-08 20:18
phokojoe27-Aug-08 20:18 
AnswerRe: remove commas in a column in mssql Pin
Blue_Boy27-Aug-08 20:47
Blue_Boy27-Aug-08 20:47 
GeneralRe: remove commas in a column in mssql Pin
phokojoe28-Aug-08 0:58
phokojoe28-Aug-08 0:58 
GeneralRe: remove commas in a column in mssql Pin
Blue_Boy28-Aug-08 1:42
Blue_Boy28-Aug-08 1:42 
GeneralRe: remove commas in a column in mssql Pin
phokojoe28-Aug-08 4:20
phokojoe28-Aug-08 4:20 
GeneralRe: remove commas in a column in mssql Pin
Blue_Boy28-Aug-08 4:27
Blue_Boy28-Aug-08 4:27 
GeneralRe: remove commas in a column in mssql Pin
phokojoe28-Aug-08 4:51
phokojoe28-Aug-08 4:51 
GeneralRe: remove commas in a column in mssql Pin
Blue_Boy28-Aug-08 5:06
Blue_Boy28-Aug-08 5:06 
QuestionHow to use a string variable in SQL query string? Pin
chenayang27-Aug-08 18:43
chenayang27-Aug-08 18:43 
AnswerRe: How to use a string variable in SQL query string? Pin
N a v a n e e t h27-Aug-08 19:33
N a v a n e e t h27-Aug-08 19:33 
GeneralRe: How to use a string variable in SQL query string? Pin
chenayang27-Aug-08 23:42
chenayang27-Aug-08 23:42 
QuestionProblem with SQL Query doing inner joins [modified] Pin
Sunset Towers27-Aug-08 14:23
Sunset Towers27-Aug-08 14:23 
AnswerRe: Problem with SQL Query doing inner joins Pin
PIEBALDconsult27-Aug-08 16:09
mvePIEBALDconsult27-Aug-08 16:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.