Hi,
i'm trying to automatize some tasks for each table, but this piece of code doesn't work :
...
DECLARE @.TableName sysname
...
drop table @.TableName ( or whatever ... )
...
...
the error message is: " Incorrect syntax near '@.TableName' "
Thanks !Try using EXECUTE command:
DECLARE @.TableName sysname
exec ('drop table ' + @.TableName )
Showing posts with label tablename. Show all posts
Showing posts with label tablename. Show all posts
Sunday, March 11, 2012
automatic code for each table - dont work
Hi,
i'm trying to automatize some tasks for each table, but this piece of code doesn't work :
...
DECLARE @.TableName sysname
...
drop table @.TableName ( or whatever ... )
...
...
the error message is: " Incorrect syntax near '@.TableName' "
Thanks !
:confused:try:
exec('drop table ' + @.TableName)|||Works! Thanx for help !
regards.
i'm trying to automatize some tasks for each table, but this piece of code doesn't work :
...
DECLARE @.TableName sysname
...
drop table @.TableName ( or whatever ... )
...
...
the error message is: " Incorrect syntax near '@.TableName' "
Thanks !
:confused:try:
exec('drop table ' + @.TableName)|||Works! Thanx for help !
regards.
Friday, February 24, 2012
Auto-generating a DateTime in SQL Server Express 2005
Is it possible to have a DateTime field in a row automatically generated when a row is created?
ie:
INSERT INTO [TableName] ([DateTimeStamp], [UserId], [Title], [Explanation]) VALUES (DateTime.Now(), @.UserId, @.Title, @.Explanation)
or something like that?
You can set up a default value of GetDate() to the column in the design view of the table.
|||Thanks! Exactly the solution I was looking for.
Labels:
auto-generating,
automatically,
createdieinsert,
database,
datetime,
datetimestamp,
express,
field,
generated,
microsoft,
mysql,
oracle,
row,
server,
sql,
tablename,
userid
Subscribe to:
Posts (Atom)