Home All Groups Group Topic Archive Search About

Creating keys/indexes for SQL table

Author
1 Dec 2006 10:27 PM
Eve
My application reads the data from one database (using ODBC connection) and
copies the data to an SQL database (using SQLBulkCopy). This is how I create
an SQL table:

Dim NewTable As Table = New Table(sqldb, "test")
....
NewTable.Columns.Add(cSQL)
....
NewTable.Create()

I'm trying to define keys and indexes for my table, but I haven't been able
to figure out how to do that. Is this possible with the class I'm using?

Thank you.

Author
2 Dec 2006 7:32 PM
Michael Nemtsev
Hello Eve,

You can set only DataTable.PrimaryKey property

E> My application reads the data from one database (using ODBC
E> connection) and copies the data to an SQL database (using
E> SQLBulkCopy). This is how I create an SQL table:
E>
E> Dim NewTable As Table = New Table(sqldb, "test")
E> ...
E> NewTable.Columns.Add(cSQL)
E> ...
E> NewTable.Create()
E> I'm trying to define keys and indexes for my table, but I haven't
E> been able to figure out how to do that. Is this possible with the
E> class I'm using?
E>
E> Thank you.
E>
---
WBR,
Michael  Nemtsev [C# MVP] :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Author
3 Dec 2006 12:48 AM
Dave Sexton
--
Dave Sexton

Show quote
"Eve" <E**@discussions.microsoft.com> wrote in message
news:2D1F401D-744C-49D9-BF8A-51A9F92BF205@microsoft.com...
> My application reads the data from one database (using ODBC connection)
> and
> copies the data to an SQL database (using SQLBulkCopy). This is how I
> create
> an SQL table:
>
> Dim NewTable As Table = New Table(sqldb, "test")
> ...
> NewTable.Columns.Add(cSQL)
> ...
> NewTable.Create()
>
> I'm trying to define keys and indexes for my table, but I haven't been
> able
> to figure out how to do that. Is this possible with the class I'm using?
>
> Thank you.
Author
3 Dec 2006 12:54 AM
Dave Sexton
Hi,

(Sorry about that accidental blank post)

Is "Table" an SMO object?

"SQL Server 2005 Books Online
How to: Create, Alter, and Remove a Table in Visual Basic .NET"
http://msdn2.microsoft.com/de-de/library/ms162203.aspx

"SQL Server 2005 Books Online
Creating, Altering, and Removing Indexes"
http://msdn2.microsoft.com/de-de/library/ms162215.aspx

--
Dave Sexton

Show quote
"Eve" <E**@discussions.microsoft.com> wrote in message
news:2D1F401D-744C-49D9-BF8A-51A9F92BF205@microsoft.com...
> My application reads the data from one database (using ODBC connection)
> and
> copies the data to an SQL database (using SQLBulkCopy). This is how I
> create
> an SQL table:
>
> Dim NewTable As Table = New Table(sqldb, "test")
> ...
> NewTable.Columns.Add(cSQL)
> ...
> NewTable.Create()
>
> I'm trying to define keys and indexes for my table, but I haven't been
> able
> to figure out how to do that. Is this possible with the class I'm using?
>
> Thank you.

AddThis Social Bookmark Button