views:

168

answers:

3

Hi folks, in a previous question i asked, the suggested answer was for me to partition my field onto another Filegroup, keeping the field in the same table.

I'm not sure how to do this.

I've tried to google for things like partition table, partition view, etc. Could anyone provide me with some links or some sample sql code?

DB Server is Sql 2008.

Table Schema

FooId  INT PK IDENTITY
Name   VARCHAR(100) NOT NULL
Boo    VARCHAR(100) NOT NULL
BlahId INT NOT NULL
Photo  VARBINARY(MAX)     <-- This field wants to go onto another filegroup.
                             Can be null.

cheers!

+1  A: 

You need to use the TEXTIMAGE ON clause in CREATE TABLE.

Aaron Alton
The BooksOnline say: " ...are keywords that indicate that the text, ntext, image, xml, varchar(max), nvarchar(max), varbinary(max), and CLR user-defined type columns are stored on the specified filegroup. "So if i do that, then Name, Boo and Photo will all be stored on the specified Filegroup? If so, how can i only set the 'photo' file be on the specified fielgroup?
Pure.Krome
name and boo aren't varchar(max) - they're varchar(100). They won't be stored with the balance of the blob fields. Varchar(max) is a variant of varchar that scales up to 2GB - not what you're using here :-D
Aaron Alton
ah haaa. right you are. kewlies :) Would i have to restore both filesystems (to a test server) or can i restore the main (default) one .. and the data will still work, it will just have NULL data for those fields. OR will the restore not work at all ?
Pure.Krome
You would need to restore all filegroups, but you can use the MOVE clause in the RESTORE DATABASE command to move your files to a different array.
Aaron Alton
Cheers mate!! :)
Pure.Krome
A: 

I prefer to keep files on a file server and just have the database store a path/file name. this would make the database small, easy to transfer to development, etc.

racer x
Thanks, but this is not a debate about _where_ to store images. I'm using varbinary(max) as an example datatype for this post topic.
Pure.Krome
A: 

Anyone know how to move columns on an existing table without dropping and recreating the table? TEXTIMAGE_ON only seems to be available for CREATE TABLE.

Mark

related questions