-
Naming temporary tables with variables
Is there a way to put a variable name into the name of a temporary table. For example, I would like to create a table called 'test@passedvariable', or test2 assuming that @passedvariable is 2. How would I go about doing this. Any help would be greatly appreciated.
Thanks,
Jon
-
Naming temporary tables with variables (reply)
------------
Jon at 5/3/00 12:04:52 PM
Is there a way to put a variable name into the name of a temporary table. For example, I would like to create a table called 'test@passedvariable', or test2 assuming that @passedvariable is 2. How would I go about doing this. Any help would be greatly appreciated.
Thanks,
Jon
-
Naming temporary tables with variables (reply)
Declare @mystring varchar(255)
set @mystring="create table test"+@passedvariable+" .....the rest of the table definition"
exec(@mystring)
fred
------------
Jon at 5/3/00 12:04:52 PM
Is there a way to put a variable name into the name of a temporary table. For example, I would like to create a table called 'test@passedvariable', or test2 assuming that @passedvariable is 2. How would I go about doing this. Any help would be greatly appreciated.
Thanks,
Jon
-
Naming temporary tables with variables (reply)
What if I wanted to do an insert into this table. For example:
INSERT INTO ##Test@passedvariable (##test2)
SELECT *
FROM test
Is this possible?
Thanks,
Jon
------------
Fred at 5/3/00 12:12:56 PM
Declare @mystring varchar(255)
set @mystring="create table test"+@passedvariable+" .....the rest of the table definition"
exec(@mystring)
fred
------------
Jon at 5/3/00 12:04:52 PM
Is there a way to put a variable name into the name of a temporary table. For example, I would like to create a table called 'test@passedvariable', or test2 assuming that @passedvariable is 2. How would I go about doing this. Any help would be greatly appreciated.
Thanks,
Jon
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|