|
-
May 26th, 2004, 02:22 PM
#1
Thread Starter
Fanatic Member
Select into
Hi!
I would like to create a table with a variable table name on the fly.. something like this
select * into mytable & suser_sname() from etc...
Any ideas?
-
May 26th, 2004, 02:38 PM
#2
strTable = CreateNewTableName(strUser)
strSQL = "select * into " & strTable & " from ..."
adoConn.Execute strSQL
CreateNewTableName could be some function that creates new table name for you. Although, you may need to pass say current user name to it.
-
May 26th, 2004, 02:42 PM
#3
Thread Starter
Fanatic Member
...
I can't do it like that...
I have a stored procedure that's populating a temp table a la
#tblxxx... At the end of this stored proc, I want to select from
that temp table into a table with the user name appended to it..
If I wait to do it when the stored proc returns to vb, then I would no longer have access to that #tbl. I have to create that #tbl temp table this way because of the multiple users that will be accessing the stored proc at the same time...
Thnks
-
May 26th, 2004, 02:59 PM
#4
Won't this work in your sproc?
Declare @QueryString varchar(100)
Set @QueryString="Insert into Table" + @UserName+" Select ..."
Exec(@QueryString)
-
May 26th, 2004, 03:03 PM
#5
Re: ...
Originally posted by Lafor
I can't do it like that...
I have a stored procedure that's populating a temp table a la
#tblxxx...
In this case just pass your new table name to that SP as parameter:
adoConn.Execute "sp_name tblName" - check syntax here as it's all free hand typing.
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
|
Click Here to Expand Forum to Full Width
|