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 |
|
NeilG
Aged Yak Warrior
530 Posts |
Posted - 2009-06-01 : 09:26:59
|
| Hi guys, I'm trying to create a process where i select the data from the last created table out and so far i've got thisDECLARE @TableName varchar(100)SET @TableName = (SELECT TOP 1 NAME FROM sys.tables group by name order by max(create_date) desc)SELECT * FROM @tablenamebut on the last section am i going to need to apply dynamic sql as i've never really had a situation where i've been require to use it so havn't got a clue |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
NeilG
Aged Yak Warrior
530 Posts |
Posted - 2009-06-01 : 09:49:14
|
| thanks |
 |
|
|
NeilG
Aged Yak Warrior
530 Posts |
Posted - 2009-06-01 : 11:05:19
|
| could anyone show me on this example how this would be do, and i can go from there are the link is confusing me on how to do something like this massive thanks in advance |
 |
|
|
NeilG
Aged Yak Warrior
530 Posts |
Posted - 2009-06-01 : 11:18:20
|
| ignore this i've just cracked if, can't for the life of me wonder why i struggle with seeing what was wrong |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-06-01 : 11:19:07
|
| DECLARE @TableName varchar(100)SET @TableName = (SELECT TOP 1 NAME FROM sys.tables group by name order by max(create_date) desc)EXEC('SELECT * FROM '+@tablename)MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|