Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
goligol
Posting Yak Master
128 Posts |
Posted - 2011-09-09 : 14:21:12
|
Hi I am importing an excel sheet in SQL using task and import.although the format of the column in excel is text, still has difficulties importing "0" and numbers like "09" to SQL and import it as NULL in SQL. I have also difficulty to edit it manually since it goes to error. I was wondering if I can use some commands to replace those nulls with actual number:SELECT [Division] ,[Fips_st] FROM [Transportation].[dev].[Dev2St_Keys]************ for example "replace Divison = 8 and Fips_st= Null with Divison=8 and Fips_s= 09"Thank you |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-09 : 14:26:15
|
[code]SELECT [Division],case when Divison=8 and Fips_st is Null then '09' else [Fips_st] endFROM [Transportation].[dev].[Dev2St_Keys][/code]i assume Fips_st is of type varchar else you've to do a cast------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
goligol
Posting Yak Master
128 Posts |
Posted - 2011-09-09 : 14:59:16
|
it will not help my case, I do not want to create a new columen:my table is as below:8 NULL8 NULL8 358 308 498 328 569 NULL9 NULLI want to replace Nulls with different numbers.example 8 09 8 018 358 308 498 328 569 049 02 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-10 : 00:58:30
|
ok thats fine. but where will you get numbers like 09,01,04 etc from? are they stored in another column or maybe in another table?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|