Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2005

    Unanswered: 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.

  2. #2
    Join Date
    Nov 2004
    on the wrong server
    Provided Answers: 6
    why not just use the ON FILEGROUP argument of the CREATE TABLE statement to create your table first and then do a INSERT INTO?
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Sep 2005
    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

  4. #4
    Join Date
    Feb 2003
    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 )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts