Monday, March 19, 2012

Create relationship programmatically

Hi,
I have metadata that stored my table structure and relationship. I would like to know is it possible to create table relationship programatically? Any sample?

Thank you


Something like this should work for you:

Code Snippet


CREATE TABLE MyTable
( Column1 int,
Column2 varchar(n)
FKCol3 int REFERENCES MyOtherTable(MyPKColumn)
)

For complete syntax, refer to Books Online, Topic: 'CREATE TABLE'

No comments:

Post a Comment