Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Problem with SSMS generated DDL (table with filestream) Expand / Collapse
Author
Message
Posted Thursday, January 10, 2013 12:00 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, June 3, 2014 2:31 AM
Points: 8, Visits: 139
Hi, I restored an external DB into a SQL Server 2008 R2 SP2 instance. I want to structure it (in terms of data location) as I want. I've tried some methods but I have finally found out that the simplest way to do it was to generate the script (via SSMS), change the code where it's needed, drop the restored database and recreate it using the modified script.

I'm experiencing a weird problem :

Multiple tables, all using filestreams have their DDL looking like this in the script generated by SSMS :

CREATE TABLE [dbo].[ClaimDocuments](
[doc_PK] [uniqueidentifier] NOT NULL,
[doc_desc] [varchar](100) NOT NULL,
[doc_clmfk] [uniqueidentifier] NOT NULL,
[doc_FileGUID] [uniqueidentifier] ROWGUIDCOL NOT NULL,
[doc_file] [varbinary](max) FILESTREAM NOT NULL,
CONSTRAINT [PK_ClaimDocuments] PRIMARY KEY CLUSTERED
(
[doc_PK] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] FILESTREAM_ON [FileStreamGroup1]

GO

Note that the last field is varbinary(max).

I am getting this error:

Cannot use TEXTIMAGE_ON when a table has no text, ntext, image, varchar(max), nvarchar(max), varbinary(max), xml or large CLR type columns.

I don't understand why the TEXTIMAGE_ON close is coming there, but I know that if I remove it, the table create works perfectly.

Can somebody help me ?
Post #1405222
Posted Thursday, January 10, 2013 1:39 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 6:53 AM
Points: 5,132, Visits: 4,922
Did you have a column which was of a blob type outside of filestream at some point?



Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1405257
Posted Thursday, January 10, 2013 1:47 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, June 3, 2014 2:31 AM
Points: 8, Visits: 139
As I said, it's an external DB for an application developped by another company. I just took their .BAK file and restored it. I don't know the history of that DB.
Post #1405265
Posted Thursday, January 10, 2013 1:52 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 6:53 AM
Points: 5,132, Visits: 4,922
Yep got the external DB, but not that it was developed by a 3rd party.

The most likely culprit is that there once was a column which was of blob type outside of filestream, (probably the current filestream column) and it was altered to use filestream still leaving behind in the metadata the textimage option of the create table, or the column was dropped still leaving behind the metadata etc.






Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1405269
Posted Thursday, January 10, 2013 3:21 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, June 3, 2014 2:31 AM
Points: 8, Visits: 139
And I suppose the only way to "sanitize" is to make a clone table, copy data from the currently used table and switch ... There is no way to clean the metadata dictionary ?
Post #1405303
Posted Thursday, January 10, 2013 3:23 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 6:53 AM
Points: 5,132, Visits: 4,922
Correct, it would be a drop and re-create of the table to flush the metadata into the new schema definition.

Or create, import, drop, rename, which is the same as the above just keeps your data.




Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1405304
Posted Thursday, January 10, 2013 3:25 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, June 3, 2014 2:31 AM
Points: 8, Visits: 139
By the way, I generated the whole database script and suppressed the references to TEXTIMAGE_ON... I now get this error

CREATE INDEX failed because the following SET options have incorrect settings: 'ANSI_PADDING'.

I suppose it is related... ??
Post #1405306
Posted Thursday, January 10, 2013 3:32 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 6:53 AM
Points: 5,132, Visits: 4,922
There is somewhere in the script setting it to OFF when it needs to be ON or to ON when it needs to be OFF, general rule of thumb is to have it ON.

http://msdn.microsoft.com/en-us/library/ms187403.aspx




Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1405310
Posted Thursday, January 10, 2013 3:38 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, June 3, 2014 2:31 AM
Points: 8, Visits: 139
Yes, just before an index creation... But I'm very surprised because it's a script generated via SSMS, and I can't get to it working at once
Post #1405316
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse