question

rudrapbiswas avatar image
rudrapbiswas asked

How to get table definition with persisted column?

To generate object creation script, I used SSMS Tasks->Generate Scripts... Everything is fine in getting the compete object DDL script with/without data. But the problem lies with the tables having persisted column. When I run the generated script to create a DB, it creates all the objects except the tables having persisted columns. Is there any way I can get rid of this? I have to get the table created with persisted column as well. Regards, --Rudra
columnddlgenerate-scripttable-usage
2 comments
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Are you getting an error? Are those objects in the script at all or are they just not appearing?
0 Likes 0 ·
When I run the entire generated script, it just throws an error: Computed column 'column' in table 'table' cannot be persisted because the column is non-deterministic. And it proceeds with creating other objects.
0 Likes 0 ·

1 Answer

· Write an Answer
Grant Fritchey avatar image
Grant Fritchey answered
Your error indicates that there is a problem with the persisted column. The calculation has to be completely deterministic. You can use the examples from the [Books Online here][1] to check the determinism on the columns. [1]: http://msdn.microsoft.com/en-us/library/ms189292(SQL.90).aspx
1 comment
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

In that case I need to manually remove the table script from the generated script.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.