stmeyer
stmeyer
Okay, so this could also be used: ``` sql INSERT INTO [dbo].[users] ( [firstname] ,[surname] ,[username] ,[email] ,[language] ,[date_last_visit] ,[comment] ,[active] ,[created] ,[modified] ,[created_by_user_id] ,[modified_by_user_id] ) VALUES ( 'test' ,'test'...
``` sql CREATE TABLE [dbo].[compositePK]( [col1] [int] IDENTITY(1,1) NOT NULL, [col2] [int] NOT NULL, [col3] [int] NOT NULL, CONSTRAINT [PK_Table_2] PRIMARY KEY CLUSTERED ( [col1] ASC, [col2] ASC ) GO...
I think it will be one query with 2 statements in it. In SQL Server you can only have one identity column per talbe. https://msdn.microsoft.com/en-us/library/ms174979.aspx says: "Only one identity column...
SqlSrv has also suport for the lastInsertId-Method: https://msdn.microsoft.com/en-us/library/ff628155%28v=sql.105%29.aspx Sorry, I will be out of office for some weeks.
Is there a reason, why you are not using lastInsertId-Method with MS SQL Server? If it works with e.g. MySQL it should work with MS SQL Sever, too.
I'm able to generate the following query now ``` sql DECLARE @tmptalbe TABLE ( [id] INTEGER IDENTITY(1, 1) ,[firstname] NVARCHAR(100) NOT NULL ,[surname] NVARCHAR(100) NOT NULL ,[username] NVARCHAR(100) NOT NULL...
I have tested it, too: ``` sql IF OBJECT_ID('dbo.testTable', 'U') IS NOT NULL DROP TABLE dbo.testTable; CREATE TABLE [dbo].[testTable] ( [id] [int] IDENTITY(1, 1) NOT NULL ,[col1] [varchar](50) NOT NULL...
Does anyone have a hint for my last question "But I was not able to find a way, to remove the primary key [id] INTEGER IDENTITY(1, 1) from the column,...
Microsoft is planning to release a new sql server driver in January: https://github.com/Azure/msphpsql/issues/58. Hopefully the issue #5104 will be fixed. Maybe, it is possible to create a solution like mine...
This is still not working: ``` sql IF OBJECT_ID('dbo.testTable', 'U') IS NOT NULL DROP TABLE dbo.testTable CREATE TABLE [dbo].[testTable] ( [id] [int] IDENTITY(1, 1) NOT NULL ,[col1] [varchar](50) NOT NULL...