Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
SQL Server 2008 - General
»
Problem with SSMS generated DDL (table with...
Problem with SSMS generated DDL (table with filestream)
Rate Topic
Display Mode
Topic Options
Author
Message
jelias 69485
jelias 69485
Posted Thursday, January 10, 2013 12:00 AM
Forum Newbie
Group: General Forum Members
Last Login: Yesterday @ 12:10 AM
Points: 5,
Visits: 57
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
anthony.green
anthony.green
Posted Thursday, January 10, 2013 1:39 AM
SSCertifiable
Group: General Forum Members
Last Login: Friday, April 12, 2013 3:51 AM
Points: 5,075,
Visits: 4,831
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
jelias 69485
jelias 69485
Posted Thursday, January 10, 2013 1:47 AM
Forum Newbie
Group: General Forum Members
Last Login: Yesterday @ 12:10 AM
Points: 5,
Visits: 57
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
anthony.green
anthony.green
Posted Thursday, January 10, 2013 1:52 AM
SSCertifiable
Group: General Forum Members
Last Login: Friday, April 12, 2013 3:51 AM
Points: 5,075,
Visits: 4,831
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
jelias 69485
jelias 69485
Posted Thursday, January 10, 2013 3:21 AM
Forum Newbie
Group: General Forum Members
Last Login: Yesterday @ 12:10 AM
Points: 5,
Visits: 57
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
anthony.green
anthony.green
Posted Thursday, January 10, 2013 3:23 AM
SSCertifiable
Group: General Forum Members
Last Login: Friday, April 12, 2013 3:51 AM
Points: 5,075,
Visits: 4,831
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
jelias 69485
jelias 69485
Posted Thursday, January 10, 2013 3:25 AM
Forum Newbie
Group: General Forum Members
Last Login: Yesterday @ 12:10 AM
Points: 5,
Visits: 57
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
anthony.green
anthony.green
Posted Thursday, January 10, 2013 3:32 AM
SSCertifiable
Group: General Forum Members
Last Login: Friday, April 12, 2013 3:51 AM
Points: 5,075,
Visits: 4,831
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
jelias 69485
jelias 69485
Posted Thursday, January 10, 2013 3:38 AM
Forum Newbie
Group: General Forum Members
Last Login: Yesterday @ 12:10 AM
Points: 5,
Visits: 57
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 »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.