Jelena
Old Hand
Points: 332
More actions
April 2, 2003 at 4:47 am
#159710
Hi,
I would like to add a column to a table...What is wrong and how to solve problem?
DECLARE @pom int
SET @pom = 1
ALTER TABLE Test
ADD Field + cast(@pom as varchar(5)) varchar(50) Null
Thanks
Andy Warren
SSC Guru
Points: 119902
April 2, 2003 at 5:37 am
#452803
If you build up a string to do the change, it's dynamic sql, which means you have to use either exec(@sql) or sp_executesql(@sql) to run it, and when you do, it run's with the callers permissions.
Andy
http://www.sqlservercentral.com/columnists/awarren/
AndySQLAndy - My Blog!Connect with me on LinkedInFollow me on Twitter
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply