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 |
sql4us
Starting Member
24 Posts |
Posted - 2013-03-13 : 14:27:40
|
Hi All,I want to know how to add percentage symbol(%) to my final sql statment, it should look belowset @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 1Incorrect syntax near '%'.Any idea how to add percentage(%) symbol?? |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2013-03-13 : 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 - 2013-03-13 : 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
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2013-03-13 : 15:03:02
|
use square brackets and it will workresult as [White_pop%] Too old to Rock'n'Roll too young to die. |
|
|
sql4us
Starting Member
24 Posts |
Posted - 2013-03-13 : 15:13:22
|
Thanks webfred :) It did work.quote: Originally posted by webfred use square brackets and it will workresult as [White_pop%] Too old to Rock'n'Roll too young to die.
|
|
|
zohaa
Starting Member
1 Post |
Posted - 2014-12-11 : 23:42:41
|
that should be done in the front end if possiblePass your [url=http://www.pass4sure.co.uk/1z0-803.html]pass4sure.co.uk[/url] on first attempt using [url=http://www.pass4sure.co.uk/JN0-360.html]JN0-360 exam[/url] and other resources. We offer [url=http://www.bentley.edu/]bentley[/url] success in real exam with up to date [url=http://www.sterling.edu/]www.sterling.edu[/url] prepared by [url=http://en.wikipedia.org/wiki/United_States_Naval_Academy]United States Naval Academy[/url] You can also find [url=https://www.facebook.com/MUIHealth]Maryland University of Integrative Health[/url] ccnp training on our site. |
|
|
|
|
|
|
|