Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Numbering

$
0
0

I am trying to generate sequential numbering for each row insertion starting from 182. 
I have table Mocha 

INSERT INTO mocha
SELECT (SELECT 182) +1,[site_id],'fake@email.com',[Phone #] ,'Updated','Y','DEFAULT','DEFAULT' from [dummy]
where [site_id] <> '1618'


an error message occur stating 

Msg 8101, Level 16, State 1, Line 1
An explicit value for the identity column in table 'mocha' can only be specified when a column list is used and IDENTITY_INSERT is ON.

I Inserted the following line 
SET IDENTITY_INSERT mocha on 

but the code still throwing same error

Mocha has the following table definitions 

[toz_id] [int] IDENTITY(1,1) NOT NULL,
[site_id] [int] NOT NULL,
[email] [varchar](100) NOT NULL,
[phone] [varchar](20) NOT NULL,
[notes] [varchar](max) NOT NULL,
[active] [char](1) NOT NULL,
[lnm] [varchar](100) NOT NULL,
[fnm] [varchar](100) NOT NULL, 

Please dvise



Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>