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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL query with SQL parameter name

Author  Topic 

SomaNZ
Starting Member

1 Post

Posted - 2011-03-20 : 23:21:47
Hi, I'm trying to do a query and one of our fields is named As (after Arsenic). I've tried select [As] "As" and 'As' with no luck, any ideas how I need to format this?

Thanks

nathans
Aged Yak Warrior

938 Posts

Posted - 2011-03-20 : 23:47:41
Does this not work for you?
declare @t table ([as] int)
insert into @t
values(1)

select [as] from @t
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-03-21 : 09:03:38
<<
I've tried select [As] "As" and 'As' with no luck
>>

You need to post the actual error meeaged you got

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

jcelko
Esteemed SQL Purist

547 Posts

Posted - 2011-03-21 : 21:17:14
The double quotes should work. The idea that arsenic is an attribute scares me; is this a cookbook database?

--CELKO--
Books in Celko Series for Morgan-Kaufmann Publishing
Analytics and OLAP in SQL
Data and Databases: Concepts in Practice
Data, Measurements and Standards in SQL
SQL for Smarties
SQL Programming Style
SQL Puzzles and Answers
Thinking in Sets
Trees and Hierarchies in SQL
Go to Top of Page
   

- Advertisement -