I am performing a data import on the SQL server. Due to fact
that I use the excel file as a source. Some of cells in excel are
actually empty, they become NULL fields after importing into the SQL
server. Actually I want these fields are empty string instead of NULL.
Does SQL server has any approach to make these fields to be empty
string instead of NULL when importing?? Or is there any store
procedure exist for converting the fields to empty string?
Thanks for your kind attention.
BennyBenny (cs_benny@.hotmail.com) writes:
> I am performing a data import on the SQL server. Due to fact
> that I use the excel file as a source. Some of cells in excel are
> actually empty, they become NULL fields after importing into the SQL
> server. Actually I want these fields are empty string instead of NULL.
> Does SQL server has any approach to make these fields to be empty
> string instead of NULL when importing?? Or is there any store
> procedure exist for converting the fields to empty string?
Since I don't know how you import the data, I can't really say what
you could do in that end.
Once the data is in SQL Server, you can say:
UPDATE tbl
SET col = ''
WHERE col IS NULL
--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||I use DTS import/export wizard to import the data from the Excel file.
So is there any ways to replace the NULL fields with empty string
beside using query to update the fields to empty string?
Erland Sommarskog <sommar@.algonet.se> wrote in message news:<Xns93C0EFC135FA3Yazorman@.127.0.0.1>...
> Benny (cs_benny@.hotmail.com) writes:
> > I am performing a data import on the SQL server. Due to fact
> > that I use the excel file as a source. Some of cells in excel are
> > actually empty, they become NULL fields after importing into the SQL
> > server. Actually I want these fields are empty string instead of NULL.
> > Does SQL server has any approach to make these fields to be empty
> > string instead of NULL when importing?? Or is there any store
> > procedure exist for converting the fields to empty string?
> Since I don't know how you import the data, I can't really say what
> you could do in that end.
> Once the data is in SQL Server, you can say:
> UPDATE tbl
> SET col = ''
> WHERE col IS NULL|||Benny (cs_benny@.hotmail.com) writes:
> I use DTS import/export wizard to import the data from the Excel file.
> So is there any ways to replace the NULL fields with empty string
> beside using query to update the fields to empty string?
Sorry, I don't use DTS so I don't know. But I want to point out the
necessity of providing people full information about what you are
doing.
If you don't get any replies, consider asking in
microsoft.public.sqlserver.dts. (Available on msnews.microsoft.com if your
ISP does not have it.)
Also check out the FAQ on http://www.sqldts.com.
--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||With DTS, you can transform the data before it gets imported. That's the
'T' in 'DTS'. When moving an Excel spreadsheet to SQL Server, there is a
place in DTS where you select the worksheet from the Excel file. At this
location, there is a Transform button. You can do simple
transformations, or you can use VB code to do more complex
transformations.
HTH,
Brain
Benny wrote:
> I use DTS import/export wizard to import the data from the Excel file.
> So is there any ways to replace the NULL fields with empty string
> beside using query to update the fields to empty string?
> Erland Sommarskog <sommar@.algonet.se> wrote in message news:<Xns93C0EFC135FA3Yazorman@.127.0.0.1>...
> > Benny (cs_benny@.hotmail.com) writes:
> > > I am performing a data import on the SQL server. Due to fact
> > > that I use the excel file as a source. Some of cells in excel are
> > > actually empty, they become NULL fields after importing into the SQL
> > > server. Actually I want these fields are empty string instead of NULL.
> > > Does SQL server has any approach to make these fields to be empty
> > > string instead of NULL when importing?? Or is there any store
> > > procedure exist for converting the fields to empty string?
> > Since I don't know how you import the data, I can't really say what
> > you could do in that end.
> > Once the data is in SQL Server, you can say:
> > UPDATE tbl
> > SET col = ''
> > WHERE col IS NULL
--
================================================== =================
Brian Peasland
dba@.remove_spam.peasland.com
Remove the "remove_spam." from the email address to email me.
"I can give it to you cheap, quick, and good. Now pick two out of
the three"
No comments:
Post a Comment