Ich versuche, diese SQL-Beispiel-Befehl in eine C# SqlCommand
zu drehen:C# SqlCommand Syntax für diesen SQL-Befehl
if not exists (select column_name
from INFORMATION_SCHEMA.columns
where table_name = 'TotalHeals'
and column_name = '"+Healee+"')
alter table TotalHeals add +Healee+ int
Was ich bisher
// TO DO check to see if column exists instead of throwing error
cmd2 = new SqlCommand("ALTER TABLE TotalHeals ADD " + Healee + " INT",openCon);
cmd2.ExecuteNonQuery();
Ich bin völlig verloren haben, wie man code die if not exists-Anweisung. Irgendeine Hilfe?
existieren zu überprüfen bin dynamisch Spalten on the fly hinzufügen und wollen nicht nur die Ausnahme fangen, wenn die Spalte bereits –