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 |
chriskhan2000
Aged Yak Warrior
544 Posts |
Posted - 2004-12-15 : 10:30:29
|
When I try to pull up some data with I get this error:Syntax error converting the varchar value 'Annie's Eatery Place' to a column of data type int.Here's my query:SELECT 0 AS ID, 'All' AS NAMEUNIONSELECT NAME, IDFROM VENDORWHERE (TAX_ID IS NULL)ORDER BY NAMECan anyone help out? THanks in advance. |
|
jhermiz
3564 Posts |
Posted - 2004-12-15 : 12:19:14
|
Try flipping ID and Name ?Can you show us DDL ?Sample data ?Your table structure?What type is Annie's Eatery Place ?????SELECT 0 AS ID, 'All' AS NAMEUNIONSELECT ID, NAMEFROM VENDORWHERE (TAX_ID IS NULL)ORDER BY NAME |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-12-15 : 18:33:09
|
Yes, you'll need to flip ID and NAME:SELECT 'All' AS NAME, 0 AS IDUNIONSELECT NAME, IDFROM VENDORWHERE (TAX_ID IS NULL)ORDER BY NAMEThe columns need to be in the same order.Tara |
 |
|
chriskhan2000
Aged Yak Warrior
544 Posts |
Posted - 2004-12-16 : 11:01:27
|
Damn!!!!! You guys are good. That would've took me couple of days to figure out. Thanks again Jon and Tara. |
 |
|
|
|
|