|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 4:15 AM
Points: 15,
Visits: 348
|
|
Hi I have a table with a column which is defined as a varchar that contains asterisks. If I query that column I get the expected results, select col from tableA e.g. 1308064*8 1522323*11
However, if I select the same column using a query with a join condition I get the following output:
Select col from tableA A left join tableB B on a.key = b.key
8.56E+17 8.61E+18
In fact I get the same output if I include a second column in the first query, e.g Select key.col from tableA
I'm running against a Sql2005 SP3 database.
Anyone got any ideas what is happening here or how to ensure I get the actual varchar value?
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Today @ 8:29 PM
Points: 11,645,
Visits: 27,738
|
|
garth i could not get a result to work the way you said; we would need something equivilent to this to test with:
With TableA ([key],col) AS (SELECT 1,'1308064*8' UNION ALL SELECT 2, '1522323*11' ), TableB ([key],col) AS (SELECT 1,'Some Stuff' UNION ALL SELECT 2, 'Other Stuff' ) Select A.col ,* from tableA A left join tableB B on a.[key] = b.[key]
Lowell
--There is no spoon, and there's no default ORDER BY in sql server either. Actually, Common Sense is so rare, it should be considered a Superpower. --my son
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Today @ 3:19 PM
Points: 827,
Visits: 5,704
|
|
How are you executing the query? Wouldn't be directly into Excel by any chance, would it?
And then again, I might be wrong ... David Webb
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 4:15 AM
Points: 15,
Visits: 348
|
|
| Hi David, I wasn't using Excel just SSMS.
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Today @ 3:19 PM
Points: 827,
Visits: 5,704
|
|
As Lowell suggested, posting the table definitions and some sample data in the form of insert statements would help. Can you replicate this behavior in other tables or is it just this particular column? Is this a table or a view? Can you post some of the varchar values and the scientific notation values that correspond to them?
And then again, I might be wrong ... David Webb
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 4:15 AM
Points: 15,
Visits: 348
|
|
Apologies to all, this was not a problem after all but 2 rogue rows in the data! I'd been looking at the data that long, that I'd confinced myslef there was something wrong going on.
Thanks for all the replies and sorry for wasting your time.
Merry Christmas to all
Gareth
|
|
|
|