verwendetes Datenbanksystem: MSSQL 2007 EXPRESS
Hi ich habe ein problem mit den einfügen einer Tabelle in eine DB.
Bekomm eine fehlermeldung falsche Syntax nähe UNSIGNED. Kann aber in meinen Command kein fehler finden. Vill fällt euch der auf.
string command = (@"Create Table " + cuw.UserName + " (ID int(32) UNSIGNED AUTO_INCREMENT, Username nvarchar(max) NOT NULL DEFAULT, Message nvarchar(max) NOT NULL DEFAULT, PRIMARY KEY (ID))");
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionStringGuestbook"].ConnectionString);
SqlCommand com = new SqlCommand(command, con);
con.Open();
com.ExecuteNonQuery();
con.Close();
MSSQL 2007 EXPRESS
Kenn ich gar nicht... 😉 Denke mal du meinst 2005/2008
Aber zum Problem:
UNSIGNED AUTO_INCREMENT
Diese Syntax gibt es im SQL Server nicht. Du willst eine Identitätsspalte erzeugen? Das geht so
CREATE TABLE [dbo].[Table_1](
[Bla] [int] IDENTITY(1,1) NOT NULL,
[Test1] [int] NULL
(
Für die Beschreibung der Syntax bitte MSDN konsultieren.
"Jedes Ding hat drei Seiten, eine positive, eine negative und eine komische." (Karl Valentin)
int(32) <-- (32) ??
> Codejunky <
Das war mir schon klar, ist int aber nicht auf jeden Fall 32bit lang?
Für abweichende Längen gibts doch bestimmt so etwas wie long usw. ?!
> Codejunky <
Nur mal so eine Zwischenfrage: Arbeite ja schon seit längeren mit dem SQL Server. Ist die Schreibweise AUTO_INCREMENT gültig? Wenn ja, mein Thread da oben nicht beachten 🙂.
"Jedes Ding hat drei Seiten, eine positive, eine negative und eine komische." (Karl Valentin)
zumindest für 2005 ist das m.E. ungültig, 2008 k.A.