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-10-28 : 15:34:19
|
| I have the following query, I know there are places that LEFT (t1.naics,6) = t2.naics97 that it can copy the t2.NAICS02 for naics8_02 but it is returning NULL for all naics8_02select t1.hs ,t1.naics ,t2.NAICS97 ,t2.NAICS02 ,naics8_02 = case when LEFT (t1.naics,6) = t2.naics97 then t2.NAICS02 else null end FROM [trade].[dev].[hs2naics8_import_2007] t1 ,[trade].[dev].[Concordance_97_to_2002] t2 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
goligol
Posting Yak Master
128 Posts |
Posted - 2011-10-28 : 16:05:15
|
| naics , NAICS97 and NAICS02 are float, |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
goligol
Posting Yak Master
128 Posts |
Posted - 2011-10-28 : 16:43:34
|
| how can I convert all those columns first to character or string? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-11-03 : 06:37:39
|
| You need to convert to decimal and then to varcharDECLARE @x float; SET @x = 123456789SELECT left(cast(cast(@x as decimal(38,2)) as varchar(100)),6)MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|