INSERT INTO dbo.TableWithonlyIdentity DEFAULT VALUES
就我而言,这很好。您如何尝试将这些行放入数据库中?SQL Server Mgmt Studio?从.NET应用程序进行SQL查询?
在“新查询”窗口的Visual Studio中运行,我得到:
不支持DEFAULT VALUES SQL构造或语句。
==>好的,因此Visual Studio无法处理它-这不是SQL Server的问题,而是Visual Studio的问题。而是使用真正的SQL
Management Studio-在那很好用!
使用ADO.NET的过程也很吸引人:
using(SqlConnection _con = new SqlConnection("server=(local); database=test;integrated security=SSPI;")){ using(SqlCommand _cmd = new SqlCommand ("INSERT INTO dbo.TableWithonlyIdentity DEFAULT VALUES", _con)) { _con.Open(); _cmd.ExecuteNonQuery(); _con.Close(); }}似乎是VS的局限性-不要在大型数据库工作中使用VS :-) Marc



