Monday, March 19, 2012

filegroups in sql server...

hi all,
i have a problem with creating filegroups in sql server...i just want to copy the names of the columns from one table into my filegroups...

this is my problem : i m writting the following code in tsql:

SELECT * INTO Sales FROM Sales1 WHERE 0=1 ON [MyFG1]

Can anyone please help meeee?? i'd like it to work this way, to copy only first column names from Sales1 to Sales but in this filegroup.

if this is not the write way...then can anyone please tell me the right syntax and the way to copy just the names into a filegroup???

thanx in advance.
Regards.why not just use the ON FILEGROUP argument of the CREATE TABLE statement to create your table first and then do a INSERT INTO?|||i have some idea like this :

CREATE TABLE NewTable ( something here to copy just column names) ON [MyFG1]

usually when column names are sfpecfied this works normally, but as i said i have to copy them from some table not specify, so if anyone knows how to fill this part in barckets please tell me



thanx a lot|||run a dynamic sql that will call a function which will return a string of the table structure that u want to create

declare @.sql varchar(1000)
set @.sql='create table NewTable ' + dbo.ReturnStruAsString('OldTable') + ' ON [MyFG1] '
execute ( @.sql )

No comments:

Post a Comment