|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Friday, November 09, 2012 2:48 PM
Points: 493,
Visits: 636
|
|
| I knew the data would be with the clustered index, but I wasn't sure whether the inner reference or outer reference would win, or whether an error would be thrown. I spent 10 minutes setting up a test environment to make sure. I would have been guessing among my three options otherwise.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 7:16 AM
Points: 1,046,
Visits: 575
|
|
GabyYYZ (10/19/2009)
SanjayAttray (10/19/2009) Very good question. I was asked this question in an interview.
Q). What's the easiest and fastest way to move data of a table from file1 to file2?
A). Move the clustered index from file1 to file2.Why would that be faster than say, creating a target table on file2 and inserting all into it from the source table?
I suppose part of the question was easiest and fastest...
Otherwise nice questions after all.
What you don't know won't hurt you but what you know will make you plan to know better
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Thursday, April 18, 2013 5:52 AM
Points: 908,
Visits: 2,797
|
|
I knew this one because I've been "bit" by it before. Would indeed be better if there was a warning.
And for the why not create another table and move the data into that, there's DDL issues and possibly space issues, too. It's also many more steps.
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 4:53 PM
Points: 7,182,
Visits: 7,281
|
|
Ouch -you got me - I didn't notice "clustered".
And I've complained about people not reading questions carefully !
Tom Is minic a gheibheann béal oscailte dorn dúnta. Is minig a cheapas beul fosgailte dòrn dùinte.
http://es.linkedin.com/in/tomthomsonsoftware
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Yesterday @ 12:32 PM
Points: 104,
Visits: 303
|
|
| Got this one wrong. I figured since there was a contradiction in the statement, SQL should complain. Why does it choose FG1 over FG2? Seems arbitrary to me.
|
|
|
|
|
Say Hey Kid
      
Group: General Forum Members
Last Login: Monday, December 26, 2011 4:13 PM
Points: 689,
Visits: 410
|
|
Hi,
I accept that others have tested and found that everything is created on FG1.
>> from SQL 2008 BOL If CLUSTERED is specified or the constraint otherwise creates a clustered index, and a <partition_scheme> is specified that differs from the <partition_scheme> or filegroup of the table definition, or vice-versa, only the constraint definition will be honored, and the other will be ignored. <<
I read that and figured that both would be created on FG2, that is, the filegroup specification on the clustered indexed is ignored.
But looking at it again, it could be read either way ...
Cheers David
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Wednesday, July 11, 2012 6:35 AM
Points: 329,
Visits: 194
|
|
Any DBCC PAGE output on this.
Regards Vinay
|
|
|
|