Hi All
Iam planning to import an Excel file into a SQL Table. In one of the colums
the data is like '123dsfgf' and it is taking as NULLS when I import into sql
Table. where as the value like '123454' is working fine.
Any Ideas please
THanks
Open up your excel spreadsheet, highlight this column, right click and
select format cells. In the number tab, select Text for this Column.
Reimport the spreadsheet.
Hilary Cotter
Looking for a SQL Server replication book?
Now available for purchase at:
http://www.nwsu.com/0974973602.html
"TZ" <TZ@.discussions.microsoft.com> wrote in message
news:7BEC7751-CBA0-45D4-AF3B-0B1F58735B1C@.microsoft.com...
> Hi All
> Iam planning to import an Excel file into a SQL Table. In one of the
colums
> the data is like '123dsfgf' and it is taking as NULLS when I import into
sql
> Table. where as the value like '123454' is working fine.
> Any Ideas please
> --
> THanks
|||Hilary,
I tried as u had mentioned and still it is not working
"Hilary Cotter" wrote:
> Open up your excel spreadsheet, highlight this column, right click and
> select format cells. In the number tab, select Text for this Column.
> Reimport the spreadsheet.
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> Now available for purchase at:
> http://www.nwsu.com/0974973602.html
>
> "TZ" <TZ@.discussions.microsoft.com> wrote in message
> news:7BEC7751-CBA0-45D4-AF3B-0B1F58735B1C@.microsoft.com...
> colums
> sql
>
>
|||post this to the SQL DTS newsgroup.
"TZ" <TZ@.discussions.microsoft.com> wrote in message
news:853F8FB5-04D6-4692-A625-04AC4F53BCD0@.microsoft.com...[vbcol=seagreen]
> Hilary,
> I tried as u had mentioned and still it is not working
> "Hilary Cotter" wrote:
Showing posts with label nulls. Show all posts
Showing posts with label nulls. Show all posts
Friday, February 24, 2012
Sunday, February 19, 2012
Importing a null delimited file
I have a text file that is delimited by nulls. Any idea on the best way to get this into a SQL Server table?You can't delimit with NULLs. Do you mean space characters: " "?|||What do you mean 'null deliminated' file. Technically all files are deliminated by a null character. So I think I misinterpret your meaning.|||Do you mean CHAR(0)?|||"Technically all files are deliminated by a null character."?
...well, I guess you could could say that every text file is delimited by an infinite number of NULL values...|||no, not an infinite number, the sequence stops after the largest prime ;)
actually, i think robert nailed it -- it's probably a hex 00 (also known as a NUL)
see http://www.jimprice.com/jim-asc.htm#controlcodes|||try using \0|||kaiowas, this is sql server, where would you suggest to use that backslash?|||r937, he has a text-file so I figured he's trying to use bcp to get the file into a table.|||Good idea using bcp. I did:
BULK INSERT nullfile FROM 'C:\nullfile.txt'
WITH (
DATAFILETYPE = 'char',
FIELDTERMINATOR = '\0',
ROWTERMINATOR = '\n'
)
and it worked :D
...well, I guess you could could say that every text file is delimited by an infinite number of NULL values...|||no, not an infinite number, the sequence stops after the largest prime ;)
actually, i think robert nailed it -- it's probably a hex 00 (also known as a NUL)
see http://www.jimprice.com/jim-asc.htm#controlcodes|||try using \0|||kaiowas, this is sql server, where would you suggest to use that backslash?|||r937, he has a text-file so I figured he's trying to use bcp to get the file into a table.|||Good idea using bcp. I did:
BULK INSERT nullfile FROM 'C:\nullfile.txt'
WITH (
DATAFILETYPE = 'char',
FIELDTERMINATOR = '\0',
ROWTERMINATOR = '\n'
)
and it worked :D
Subscribe to:
Posts (Atom)