Showing posts with label delimited. Show all posts
Showing posts with label delimited. Show all posts

Sunday, March 25, 2012

Data export from SQl in CSV format

Hi
I want to export data out of SQL database using a query into a Comma Delimited(CSV) file. Some one suggested that I can use BCP.exe, I am not sure how to use it properly.
Can some please suggest how to do it? I am not a SQL DBA & is struggling with this.It's much easier to do this using the DTS Data Export under the Tools menu
in the Enterprise Manager. Pick Text File as your destination. The default
format is CSV with embedded double quotes correctly handled.
If you use BCP, you'll have to deal with the embedded double quotes in each
column where that's an possibility, using a TSQL function such as REPLACE().
--
Linchi Shea
linchi_shea@.NOSPAMml.com
"singh" <anonymous@.discussions.microsoft.com> wrote in message
news:6ECE17F7-1A1D-4526-A94E-DCD97F90E04C@.microsoft.com...
> Hi
> I want to export data out of SQL database using a query into a Comma
Delimited(CSV) file. Some one suggested that I can use BCP.exe, I am not
sure how to use it properly.
> Can some please suggest how to do it? I am not a SQL DBA & is struggling
with this.
>|||You can also use command line osql.exe and there is documentation in Books
on Line on the syntax.
Rand
This posting is provided "as is" with no warranties and confers no rights.|||Rand;
Could you please elaborate? Are you talking about the -s command line option
of osql.exe?
--
Linchi Shea
linchi_shea@.NOSPAMml.com
"Rand Boyd [MS]" <rboyd@.onlinemicrosoft.com> wrote in message
news:4roszLKqDHA.2604@.cpmsftngxa06.phx.gbl...
> You can also use command line osql.exe and there is documentation in Books
> on Line on the syntax.
> Rand
> This posting is provided "as is" with no warranties and confers no rights.
>|||The -s parameter does allow you to define a column delimiter. The default,
I believe, is a tab.
Rand
This posting is provided "as is" with no warranties and confers no rights.

Wednesday, March 7, 2012

Data being cut off on text import

I am trying to use SQL Server 2000 import/export funtion to import a
tab delimited text file. Some of the lines have upwards fo 27,000
characters in it. The first column of data is only 16 characters, the
rest in the second column. When I import it works however end up on
the largest data set to only have 8194 characters of data in the
field. I am importing the data into an NTEXT field but no joy. Any
suggestions?
Thanks.
JR
How are you determining that there are 8194 characters? Are you selecting
the data in Query Analyzer, copying it, and measuring the length? In this
case, the output is limited to 8192 characters, and does not necessarily
truly represent the data in the column. Try applying DATALENGTH() to the
column directly.
"JR" <jriker1@.yahoo.com> wrote in message
news:4d9da209-6bd6-4537-a3f9-184b6544ff49@.l1g2000hsa.googlegroups.com...
>I am trying to use SQL Server 2000 import/export funtion to import a
> tab delimited text file. Some of the lines have upwards fo 27,000
> characters in it. The first column of data is only 16 characters, the
> rest in the second column. When I import it works however end up on
> the largest data set to only have 8194 characters of data in the
> field. I am importing the data into an NTEXT field but no joy. Any
> suggestions?
> Thanks.
> JR

Data being cut off on text import

I am trying to use SQL Server 2000 import/export funtion to import a
tab delimited text file. Some of the lines have upwards fo 27,000
characters in it. The first column of data is only 16 characters, the
rest in the second column. When I import it works however end up on
the largest data set to only have 8194 characters of data in the
field. I am importing the data into an NTEXT field but no joy. Any
suggestions?
Thanks.
JRHow are you determining that there are 8194 characters? Are you selecting
the data in Query Analyzer, copying it, and measuring the length? In this
case, the output is limited to 8192 characters, and does not necessarily
truly represent the data in the column. Try applying DATALENGTH() to the
column directly.
"JR" <jriker1@.yahoo.com> wrote in message
news:4d9da209-6bd6-4537-a3f9-184b6544ff49@.l1g2000hsa.googlegroups.com...
>I am trying to use SQL Server 2000 import/export funtion to import a
> tab delimited text file. Some of the lines have upwards fo 27,000
> characters in it. The first column of data is only 16 characters, the
> rest in the second column. When I import it works however end up on
> the largest data set to only have 8194 characters of data in the
> field. I am importing the data into an NTEXT field but no joy. Any
> suggestions?
> Thanks.
> JR

Data being cut off on text import

I am trying to use SQL Server 2000 import/export funtion to import a
tab delimited text file. Some of the lines have upwards fo 27,000
characters in it. The first column of data is only 16 characters, the
rest in the second column. When I import it works however end up on
the largest data set to only have 8194 characters of data in the
field. I am importing the data into an NTEXT field but no joy. Any
suggestions?
Thanks.
JRHow are you determining that there are 8194 characters? Are you selecting
the data in Query Analyzer, copying it, and measuring the length? In this
case, the output is limited to 8192 characters, and does not necessarily
truly represent the data in the column. Try applying DATALENGTH() to the
column directly.
"JR" <jriker1@.yahoo.com> wrote in message
news:4d9da209-6bd6-4537-a3f9-184b6544ff49@.l1g2000hsa.googlegroups.com...
>I am trying to use SQL Server 2000 import/export funtion to import a
> tab delimited text file. Some of the lines have upwards fo 27,000
> characters in it. The first column of data is only 16 characters, the
> rest in the second column. When I import it works however end up on
> the largest data set to only have 8194 characters of data in the
> field. I am importing the data into an NTEXT field but no joy. Any
> suggestions?
> Thanks.
> JR