﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / SQL Server Newbies  / sequencial insert / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 22 May 2013 13:55:50 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: sequencial insert</title><link>http://www.sqlservercentral.com/Forums/Topic1428869-1291-1.aspx</link><description>Like this?[code="sql"]CREATE TABLE MyTable	(COMCOD SMALLINT,	SIRCODE BIGINT IDENTITY(1802000001000, 1000),	DESCRIPTION VARCHAR(255));GOINSERT INTO MyTable (COMCOD, DESCRIPTION)VALUES	(3306, 'A'),	(3306, 'B'),	(3306, 'c'),	(3306, 'd');GOSELECT	*FROM	MyTable;[/code]</description><pubDate>Wed, 10 Apr 2013 02:09:58 GMT</pubDate><dc:creator>Sean Pearce</dc:creator></item><item><title>RE: sequencial insert</title><link>http://www.sqlservercentral.com/Forums/Topic1428869-1291-1.aspx</link><description>[quote][b]Rauf Miah (3/10/2013)[/b][hr]"List of Heads" of A, B, C, D data type is nvarchar(250)[/quote]Thanks.  I just got off from work and, if someone doesn't beat me to it (lots of capable folks on this forum), I'll give it a shot after work tomorrow night.Lynn is correct, though.  Is the "list of heads" in a table column that way or just in a single variable?</description><pubDate>Sun, 10 Mar 2013 22:14:56 GMT</pubDate><dc:creator>Jeff Moden</dc:creator></item><item><title>RE: sequencial insert</title><link>http://www.sqlservercentral.com/Forums/Topic1428869-1291-1.aspx</link><description>[quote][b]Rauf Miah (3/10/2013)[/b][hr]"List of Heads" of A, B, C, D data type is nvarchar(250)[/quote]Where does this data come from?</description><pubDate>Sun, 10 Mar 2013 21:34:47 GMT</pubDate><dc:creator>Lynn Pettis</dc:creator></item><item><title>RE: sequencial insert</title><link>http://www.sqlservercentral.com/Forums/Topic1428869-1291-1.aspx</link><description>"List of Heads" of A, B, C, D data type is nvarchar(250)</description><pubDate>Sun, 10 Mar 2013 18:36:50 GMT</pubDate><dc:creator>Rauf Miah</dc:creator></item><item><title>RE: sequencial insert</title><link>http://www.sqlservercentral.com/Forums/Topic1428869-1291-1.aspx</link><description>[quote][b]Rauf Miah (3/10/2013)[/b][hr]I like to insert SIRCODE in Sequence like x= x+1000 Then it look likeComcod        Sircode         Sirdesc3306            100001000     A3306            100002000     B3306            100003000     C[/quote]Yes.  We know that.  Please see my previous post.  We need to know where the "List of Heads" of A, B, C, D "lives" and what format it is in.</description><pubDate>Sun, 10 Mar 2013 09:57:56 GMT</pubDate><dc:creator>Jeff Moden</dc:creator></item><item><title>RE: sequencial insert</title><link>http://www.sqlservercentral.com/Forums/Topic1428869-1291-1.aspx</link><description>[quote][b]Rauf Miah (3/10/2013)[/b][hr]I like to insert SIRCODE in Sequence like x= x+1000 Then it look likeComcod        Sircode         Sirdesc3306            100001000     A3306            100002000     B3306            100003000     C[/quote]Hey Rauf, you got the attention of two of the best people there...if you answer their questions you will learn so much...</description><pubDate>Sun, 10 Mar 2013 04:04:22 GMT</pubDate><dc:creator>mister.magoo</dc:creator></item><item><title>RE: sequencial insert</title><link>http://www.sqlservercentral.com/Forums/Topic1428869-1291-1.aspx</link><description>I like to insert SIRCODE in Sequence like x= x+1000 Then it look likeComcod        Sircode         Sirdesc3306            100001000     A3306            100002000     B3306            100003000     C</description><pubDate>Sun, 10 Mar 2013 00:03:04 GMT</pubDate><dc:creator>Rauf Miah</dc:creator></item><item><title>RE: sequencial insert</title><link>http://www.sqlservercentral.com/Forums/Topic1428869-1291-1.aspx</link><description>[quote][b]zahid_7777 (3/9/2013)[/b][hr]I have list of Heads like A, B, C, D....and like to insert in a table with three column COMCOD, SIRCODE, DESCRIPTIONPrimary key SIRCODE nchar(12) and starts from '1802000001000' , next '1802000002000', next '1802000003000' and so on. The will look likeCOMCOD      SIRCODE                 DESCRIPTION3306           1802000001000        A3306           1802000002000        B3306           1802000003000        c3306           1802000004000        d...3306           1802000021000        rtrt[/quote]Where is the "list of Heads"?  Is it in a normalized table or in a single "cell" of a table or in a single variable.  If either of the latter two, how is it stored?  As a CSV, TSV, Fixed Width multi-entry or what?As a bit of a sidebar and although I know you probably can't change it, I think it a bit insane to store numbers only values that need to be incremented (and, therefor, calculated) in an NCHAR column for several reasons.  NCHAR usually makes no difference on numeric values, requires some special handling to increment, and wastes space because it requires 2 bytes per character.  Your NCHAR(12) definition of this column occupies 24 bytes as opposed to just 8 bytes that would be used by a BIGINT.Last but not least, your SIR Code appears to have a prefix and a sequence as a suffix.  That also means that you have to use substring to split the 2 component parts out of the code for reporting.  It would be a far better thing to store the 2 parts in separate columns and use a persisted computed column to put them together for display or reporting purposes.If you can answer my questions as to "where" the "list of heads" is and what format it's in that I've identified in the first paragraph of this response, I'm positive that someone will be able to show you a relatively easy method to satisfy your requirements even if they, too, don't agree with the structure of the table.</description><pubDate>Sat, 09 Mar 2013 07:51:20 GMT</pubDate><dc:creator>Jeff Moden</dc:creator></item><item><title>RE: sequencial insert</title><link>http://www.sqlservercentral.com/Forums/Topic1428869-1291-1.aspx</link><description>Ok... so what's the question/problem?</description><pubDate>Sat, 09 Mar 2013 05:36:59 GMT</pubDate><dc:creator>GilaMonster</dc:creator></item><item><title>sequencial insert</title><link>http://www.sqlservercentral.com/Forums/Topic1428869-1291-1.aspx</link><description>I have list of Heads like A, B, C, D....and like to insert in a table with three column COMCOD, SIRCODE, DESCRIPTIONPrimary key SIRCODE nchar(12) and starts from '1802000001000' , next '1802000002000', next '1802000003000' and so on. The will look likeCOMCOD      SIRCODE                 DESCRIPTION3306           1802000001000        A3306           1802000002000        B3306           1802000003000        c3306           1802000004000        d...3306           1802000021000        rtrt</description><pubDate>Sat, 09 Mar 2013 04:46:26 GMT</pubDate><dc:creator>Rauf Miah</dc:creator></item></channel></rss>