|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Aug 2000
Messaggi: 1209
|
Esiste un comando per SQL Server2000 tipo, "CREATE TAB
Con VB .NET + SQL Server2000, vorrei creare una tabella solo se non esiste gia', con MySql si usa il comando cha ho scritoto qui' sotto, come si fa per SQL Server2000 ???
Dim sql As String = "CREATE TABLE IF NOT EXISTS clienti(nome varchar(30))" |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Apr 2001
Città: Lyon
Messaggi: 112
|
if (exists (select * from sysobjects
where name = '<table>' and type = 'U ')) drop table <table> o qualcosa di simile...
__________________
Be Glopil !!! Grand Fainéant !FANCAZZISTA MAXIMUS - Gran Modificatore della Sacra Santa Quinta Regola - Moderatore Voci Nel Web |
|
|
|
|
|
#3 | |
|
Senior Member
Iscritto dal: Aug 2000
Messaggi: 1209
|
Quote:
Ho trovato: ----------------------------------------------------------------------------------- Dim conn As New SqlConnection("Data Source=localhost;Initial Catalog=my_database;Integrated Security=SSPI;") 'crea la tabella clienti solo se non esiste Dim sql As String = "if not exists (select * from dbo.sysobjects where xtype = 'U' and name = 'clienti') CREATE TABLE clienti (nome varchar(30)" Dim Command As New SqlCommand(sql, conn) Command.Connection.Open() Command.ExecuteNonQuery() Command.Connection.Close() |
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 19:00.



















