| Author |
Topic  |
|
|
sql4us
Starting Member
24 Posts |
Posted - 03/13/2013 : 14:27:40
|
Hi All,
I want to know how to add percentage symbol(%) to my final sql statment, it should look below
set @finalSelect = 'SELECT NAME,State,TotalPop, ' + @parameter +'_Pop% FROM '
Result: NAME, State, TotalPop, White_Pop% (column names)
When I add % symbol it throws an error:
Msg 102, Level 15, State 1, Line 1 Incorrect syntax near '%'.
Any idea how to add percentage(%) symbol?? |
|
|
webfred
Flowing Fount of Yak Knowledge
Germany
8515 Posts |
Posted - 03/13/2013 : 14:52:11
|
is it part of a column name? then the column name should be for example in square brackets [White_Pop%]
otherwise please explain more clear what you are trying to do...
Too old to Rock'n'Roll too young to die. |
 |
|
|
sql4us
Starting Member
24 Posts |
Posted - 03/13/2013 : 15:00:30
|
Thanks for your reply webfred. No, its not part of the column name. My final sql statement: set @finalSelect = 'SELECT NAME,State,TotalPop, result as White_pop% FROM '
Here the column name "result" I want to call as "White_Pop%". Some how other symbols like Income($) it works fine but when I use % symbol it throws me an error.
quote: Originally posted by webfred
is it part of a column name? then the column name should be for example in square brackets [White_Pop%]
otherwise please explain more clear what you are trying to do...
Too old to Rock'n'Roll too young to die.
|
 |
|
|
webfred
Flowing Fount of Yak Knowledge
Germany
8515 Posts |
Posted - 03/13/2013 : 15:03:02
|
use square brackets and it will work
result as [White_pop%]
Too old to Rock'n'Roll too young to die. |
 |
|
|
sql4us
Starting Member
24 Posts |
Posted - 03/13/2013 : 15:13:22
|
Thanks webfred :) It did work.
quote: Originally posted by webfred
use square brackets and it will work
result as [White_pop%]
Too old to Rock'n'Roll too young to die.
|
 |
|
| |
Topic  |
|