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 |
neeraj1401
Starting Member
36 Posts |
Posted - 2009-01-29 : 06:35:32
|
I want to create a table which contain the current date in the name like table29012008. Please advice. Thanks in advance |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-01-29 : 06:38:11
|
This is a path you don't want to enter.Things will be harder to maintain and code.Have one table and add the date as a column instead. E 12°55'05.63"N 56°04'39.26" |
|
|
neeraj1401
Starting Member
36 Posts |
Posted - 2009-01-29 : 06:45:45
|
Thanks for quick reply. I'm working on script which will marge the data of some tables into one table, which will further use as input of other process. I have to maintain the archive of tables as per given format, so i can not change the structure. |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-01-29 : 06:51:27
|
declare @temp table (val int identity(1,1) primary key, currentdate varchar(32))insert into @tempselect 'table'+REPLACE(CONVERT(VARCHAR(10), GETDATE(), 3), '/', '') union allselect 'table'+REPLACE(CONVERT(VARCHAR(10), GETDATE()+1, 3), '/', '') union allselect 'table'+REPLACE(CONVERT(VARCHAR(10), GETDATE()+2, 3), '/', '') select * from @temp |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-01-29 : 06:53:53
|
Then you have to create the tables with dynamic SQL.Good luck and God speed... E 12°55'05.63"N 56°04'39.26" |
|
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2009-01-29 : 10:14:43
|
Yeah, good luck with that.And good luck to the guy who comes along three months after you leave and has to figure out why it suddenly stopped working.________________________________________________If it is not practically useful, then it is practically useless.________________________________________________ |
|
|
|
|
|
|
|