Strange Behaviour Of Auto Increment ID Column
Mar 15, 2007
Hi members,
I am facing a grange error, I hv an asp .net application running with sql server 2000 on a web server.
one table say tblProducts, I have few colums in it with an ID Primery Key field which is auto increment.
I have around 1500 records in it, what i am seeing is that autonumbers are not comming in sequence. it is skiping few numbers after rendom intervals.
like
1
2
3
4
5
7
9
12
13
14
like this there is no error in the code as its only a simple insert query. can anybody tell me what could be the reason.
regards
Aloha
View 3 Replies
ADVERTISEMENT
May 2, 2008
How can I put an Auto increment on a non PK field?
for ordering contents items?
View 9 Replies
View Related
Oct 16, 2014
I have a column that is not set to auto increment "IDX and Im inserting 800 part numbers but i want the IDX column to start at IDX 400 and increment 1 time per part number that is inserted. how can i accomplished that task.
EXAMPLE:
IDX PART#
400 abcde
401 fghi
402 jklm
etc. and so forth until the last part# will have IDX 1200...
View 1 Replies
View Related
Aug 22, 2006
Hi there,
With a Union all Query is there a way to have it also generate
an Auto Increment (number) column that is appended to the Union all results
?
View 2 Replies
View Related
Feb 8, 2008
i've posted in the wrong forum, so im posting here
hi, im having problems to import data from my excel to a sql table.
in the excel file i have exact the same fields that i have in the table excepts the primary key which is an auto increment. When i try to import data, an error that i can't insert nulls into my auto increment column.
I put enable identity insert in the edit options, but still doesnt work.
can anyone help?
thanks in advance
View 1 Replies
View Related
Aug 29, 2007
I have a column with consist of customer number.e.g.
c001
c002
c003
How do I add the character "c" to the auto-incremental number everything I add?
View 7 Replies
View Related
Oct 27, 2006
trying to change a column that is just a INT NOT NULL column, to have an auto-increment.
Code:
ALTER TABLE [ImpExpTables].[dbo].[ImpExp_eBayLocalNeedsDeleted]
ALTER COLUMN ID int IDENTITY(1,1) NOT NULL
just gives error at IDENTITY
View 7 Replies
View Related
Oct 19, 2005
Hello all,I'm using SS2K on W2k.I'v got a table say, humm, "Orders" with two fields in the PK:OrderDate and CustomerID. I would like to add an "ID" column whichwould be auto-increment (and would be the new PK). But, I would reallylike to have orders with the oldest OrderDate having the smallest IDnumber and, for a same OrderDate, I'd to have the smallest CustomerIDfirst. So my question is:How could I add an auto-increment column to a table and make it createits values in a particular order (sort by OrderDate then CustomerIDhere)?In the real situation, the table I want to modify has around 500krecords and the PK has 5 fields and I want to sort on three of them.Thanks for you helpYannick
View 7 Replies
View Related
Mar 7, 2011
Due to localization I have the need to make child tables, where there is a composite Primary Key, between the Id column and the LanguageSign column. On the parent table the Id column is Identity column with auto increment.
The problem is that during the select into query to copy columns from parent to child, this auto increment behaviour of the parent-Id is copied to the child-Id. However I do not want that, because the same Id will be used by different LanguageSign entries
Is there a way to use 'select into' without copying the auto increment, or is my only option to make a whole new column without auto increment on the child and copy the records?
Â
btw I have used this statement
SET
IDENTITY_INSERT MyTable
ON , so that inserting into the Id column is possible. I can see however that this does not take away the auto increment...
View 4 Replies
View Related
Dec 28, 2007
i would to make a column contains of 3 characters and 6 auto increment numbers (example: "DLL - 123456")
and made it primary key and which data type i should use. i do not know whether i use after insert trigger in two columns one for three characters and another for code which has identity property >>>so please help me
View 4 Replies
View Related
Dec 11, 2007
Hello,
I Have a table that needs to have 2 unique number.
detail_id and detail_print_id.
detail_id is already an IDENTITY.
both fields need to be different, because when importing, it imports the same data into a table twice, with only a slight data change (and id is not one of the changes).
So I thought i could do the following:
detail_id INT NOT NULL IDENTITY(1,2),
detail_print_id INT NOT NULL IDENTITY(2,2),
--blah blah
that way, the detail_id will always be odd, and the detail_print_id will always be even. however SQL Server 2005 only allows 1 identity per table, and both these fields need to be auto generated when the field is inserted, so as to prevent double data.
is there anyway I can create a int column to auto increment, without the column being an IDENTITY??
also, I would prefer to not have to create a second table with a single column just for this work.
Thanks,
Justin
View 5 Replies
View Related
Jan 23, 2004
I have an MS SQL Server table with a Job Number field I need this field to start at a certain number then auto increment from there. Is there a way to do this programatically or within MSDE?
Thanks, Justin.
View 3 Replies
View Related
Oct 3, 2006
This is the actual statement displayed from Response.Write in classic ASP. INSERT INTO WOTasks (WoNum,TaskNum,TaskDesc,TaskMemo,Account,ModifyDate,Estimate,TaskHours,Unit,UnitCost,TotalCost) SELECT '06-012497',TaskNum,TaskDesc,TaskMemo,Account,'2006-Oct-3',1,TaskHours,Unit,UnitCost,TotalCost FROM Tasks WHERE procnum = '000002' There are 4 records returned from the SELECT part of the statement. In some situations, 4 records are inserted to WOTasks table, in others, only 1 record is inserted. I can't find out why 1 record, instead of 4, record is inserted. A form page submits the form to the save page using post method. The above statement is contained in the save page. When one of the form textbox is filled, 1 record is inserted. When the textbox is not filled, 4 records are inserted. You may think the textbox has something to do with the behaviour. I also think so but the content of the textbox does not affect the sql statement. In both cases, the insert statement is the same. In the actual codes, only strings in quotes are variables and the rest are hardcoded. When I run the statement in SQL Server, 4 records are affected. No such problem when connected with Access.The actual code belowSub AddTask(ByVal proc, ByVal wonum) Dim sSQL sSQL = "INSERT INTO WOTasks (WoNum,TaskNum,TaskDesc,TaskMemo,Account,ModifyDate,Estimate,TaskHours,Unit,UnitCost,TotalCost) SELECT '" & wonum & _ "',TaskNum,TaskDesc,TaskMemo,Account,'" & curDate & "',1,TaskHours,Unit,UnitCost,TotalCost FROM Tasks WHERE procnum='" & proc & "'" 'Response.Write sSQL:Response.End conn.Execute sSQL, , 128 End Sub
View 2 Replies
View Related
Aug 8, 2007
Hi,
In My report I have 2 drop down list called Cusip and Period as parameters and they are populated using a sproc
I have a list and in my list i have 2 textboxes which have the value First(Fields!FundNameNoFee.Value) and First(Fields!FundDescription.Value)
The Cusip drop list has the following values <All Cusips> whchi takes the Value Null, 33335454, 115544454.
If i give all cusips in preview mode Nothing populates in the report, but i just run the dataset i get 2 records with 33335454,1155445454.
and if i give individual cusip, the data shows up in the report...
So can some one tell me how can i show the values on the reports when All Cusips are selected....
Regards
Karen
View 3 Replies
View Related
Oct 11, 2007
Hi to all!
i had tried to install ads on a windows 5. i am able to connect to the pocket database. however when i trie to connect to the database that's on desktop i see a little window (probably a message) without anything and when i tap ok i see a message telling that the connection to the desktop database was not done! i had made the configuration before.
can you tell me what is going wrong?
View 1 Replies
View Related
Oct 25, 2007
We have this webiste which uses SQL express as database engine. Sometimes certain features of the website stop working. Like membership provider and other database related things. I have described the problem in more details here: http://forums.asp.net/t/1172253.aspx
In consice the problem is: One query with fixed inputs does not always return the same results, though the data has not changed, you restart the SQL express and the problem resolives!
I think thats a problem with SQL express, because when you restart SQL express everything starts working. Our database is kinda big. Like above 500 MB with up to 50 concurrent users. And our machine got a 3.2 CPU with 512 MB of ram. And our application is the only application runing there.
What do you think please?
View 5 Replies
View Related
Aug 12, 2000
Hi...
Not sure what's wrong with the query or table, but I just can't get the result I want.
The column is varchar(35) and contains toll free no, like 18001234567...
But when I queried using the query below, I can't get any results. Same if I use 1*, 18*, 180*...
SELECT ... FROM ...
WHERE CONTAINS(toll_no, '"1800*"')
However, if I used 18001* I do get results.
Can anybody show me how to get result for these cases?
Thanks.
View 2 Replies
View Related
Oct 12, 2000
I have a scheduled job that inserts some records into a table. It fails with the following message,
Violation of PRIMARY KEY constraint 'PK_FuturesOut'. Cannot insert duplicate key in object 'FuturesOut'. [SQLSTATE 23000] (Error 2627) The statement has been terminated. [SQLSTATE 01000] (Error 3621). The step failed.
The strange thing about this is, if I copy the SQL statement from the job and paste it into Query Analyzer, it works without any modifications.
If anyone can explain this I would be most grateful.
View 2 Replies
View Related
Aug 3, 2007
I use bcp fairly often in SQLServer2000 but have never run across this before. In a 512 SQLCHAR column containing notes, when two spaces are encountered (i.e. ' '), bcp is replacing ' ' with '
'.
I figured it was a problem with my format file, but I have not found enough specific info on the MSDN site to resolve this.
This is my bcp command:
bcp "SELECT DivCode,CommCode,ContactID,substring(Notes, 0, 512) from frep.dbo.BeBackExtract" queryout "D:BeBackDetail.dat" -f "D:BeBackDetail.fmt" -e "D:BeBackDetailErrors.dat" -U user -P pass -S server
And format file:
8.0
4
1 SQLCHAR 0 2 "" 1 DIVCODE ""
2 SQLCHAR 0 3 "" 2 COMMCODE ""
3 SQLCHAR 0 10 "" 3 CONTACTID ""
4 SQLCHAR 0 512 "
" 4 NOTES ""
Has anyone seen this?
Incidentally I also tried using the REPLACE function which seems to work great until trying to replace 2 spaces with 1 space, in which case it doesn't do anything.
Thanks for any ideas -
View 1 Replies
View Related
Nov 15, 2006
Hi,
I am seeming strange results with a query. I have two tables, lets call them Table1 and Table2. Table1 has an ID field, Table2 does not have an ID field. To be sure I wasn't blind, the query
'SELECT ID FROM Table2'
returns: Invalid column name 'ID'. OK. Now when I run the query
'SELECT * FROM Table1 WHERE ID IN (SELECT ID FROM Table2)'
it returns all the records from Table1.
What gives? Is this a bug, or am I missing something?
View 8 Replies
View Related
Aug 31, 2007
I am facing a strange problem.
SSIS is executing a piece of code which is inside comment !!!
I have got a master package which executes number of other packages. When I right click on a package and click "Execute task", SSIS respects the comments and ignores code inside it.
But when I execute master package, SSIS executes piece of code which is inside comment!!!
The only thing I can think of is when executed from Master package, SSIS somehow picks very old precompiled binary. BTW, precompile=false for the script component so it shouldn't use precompiled binary at all.
I am sure it will be fixed if I delete and recreate this particular script component with the same script. I (luckily!) picked up this problem but the thought of SSIS not executing intended binary scares the hell out of me.
Any thoughts??? or its just me happened to be using SSIS on Friday?
View 14 Replies
View Related
Feb 27, 2002
Strange MS Access behaviour! URGENT please!!
We have a view looking at all the columns of a table on a SQL server 7.0 db. When we link this view to MSAccess, we are seeing the old data which was there previously in the original table! not the latest data. We recompiled the table and views and also re-linked the view to MSAccess with no help,we still see the old data only.This is happening only for one of the views not for all.Any help???
sa.
View 2 Replies
View Related
Jan 20, 2000
When write the following in Query Analyzer (SQL-Server 7 SP1):
declare @aA int
select @aa = 1
I get:
Server: Msg 137, Level 15, State 1, Line 3
Must declare the variable '@aa'.
SQL-Server 6.0 and 6.5 seems to work OK.
I have tried several other random combinations f.ex.:
declare @Aa int
select @aa = 1
and all seems to work OK
I dicovered the error when I used the upgrade wizard to move a database from
SQL-Server 6 to SQL-server 7
sp_helpsort gives the following:
Unicode data sorting
----------------------
Locale ID = 1044
case insensitive, kana type insensitive, width insensitive
Sort Order Description
----------------------------------------------------------------------------
--------------------------------------------------------
Character Set = 1, iso_1
ISO 8859-1 (Latin-1) - Western European 8-bit character set.
Sort Order = 183, danno_nocasepref
Case-insensitive Danish/Norwegian dictionary sort order, with
case preference for collating purposes. Uses the ISO 8859-1 ch
aracter set with Windows 3.1 additional characters.
Characters, in Order
----------------------------------------------------------------------------
--------------------------------------------------------
! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ ] ^ _ ` { | }
~ ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ * ® ¯ ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾
¿ × ÷ 0 1 2 3 4 5 6 7 8 9 A=a Á=á À=à Â=â Ã=ã B=b C=c Ç=ç D=d Ð
=ð E=e É=é È=è Ê=ê Ë=ë F=f G=g H=h I=i Í=í Ì=ì Î=î Ï=ï J=j K=k L
=l M=m N=n Ñ=ñ O=o Ó=ó Ò=ò Ô=ô Õ=õ P=p Q=q R=r S=s ß T=t Þ=þ U=u
Ú=ú Ù=ù Û=û V=v W=w X=x Y=y Ü=ü Ý=ý ÿ Z=z Æ=æ Ä=ä Ø=ø Ö=ö Å=å
View 1 Replies
View Related
Jan 28, 2004
Hi,
I have written an udf that checks for validations of an email address and returns 0 / 1 as per the validations. I came across an artical on MSDN that describes the steps to make my own system udf. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsqlpro01/html/sql01l1.asp
with help of that artical, I made my udf as a system udf. and now I can use it as follows.
select * , fn_isvalidemail(email) from #tp
now, I wanted to use this as a declarative check constraints in my tables. so I tried
create table testtable
( email_addr varchar (255) null CONSTRAINT CK_email_chk CHECK ( fn_isvalidemail(email) = 1) )
although this is syntax is logically correct, it does not get compiled
it gives me an error saying,
Server: Msg 195, Level 15, State 10, Line 2
'fn_isvalidemail' is not a recognized function name.
the strange part is that i made the function as another normal udf, It works in declarative constraints.
create table testtable
( email varchar (255) null CONSTRAINT CK_1p12 CHECK ( dbo.isvalidemail(email) = 1) )
Any thoughts on this ?
- Amit
View 2 Replies
View Related
Jul 20, 2005
HiI've done a search and found plenty on ORDER BY problems, but mineshopefully a syntax error.This is a test segment from my stored procedure.DECLARE @Name varchar(50), @SortType IntSET @Name = "canal lock"SET @SortType = 8SELECT dbo.ite_Item.ite_IDFROM dbo.ite_Item LEFT OUTER JOINdbo.iti_ItemImages ONdbo.ite_Item.ite_ID = dbo.iti_ItemImages.iti_LinkToItemWHERE iti_ItemImages.iti_LinkToPhotoType=1AND ite_Name LIKE '%' + @Name + '%'ORDER BYCASEWHEN @SortType = 3 THEN dbo.ite_Item.ite_DateWHEN @SortType = 5 THEN dbo.ite_Item.ite_ViewsWHEN @SortType = 7 THEN dbo.ite_Item.ite_DescriptionEND ASC,CASEWHEN @SortType = 2 THEN dbo.ite_Item.ite_NameWHEN @SortType = 4 THEN dbo.ite_Item.ite_DateWHEN @SortType = 6 THEN dbo.ite_Item.ite_ViewsWHEN @SortType = 8 THEN dbo.ite_Item.ite_DescriptionEND DESC,CASEWHEN @SortType <> 2 THEN dbo.ite_Item.ite_NameEND ASCI get various errors:@SortType = 2. This is a Name field varchar(50)Syntax error converting the varchar value 'Canal Lock' to a column ofdata type smallint.I only have one smallint col and that is the ite_Views column. Why isit trying to convert a varchar(50) col?@SortType = 3. This is a ISO date field nchar(8)The conversion of the nvarchar value '20030909' overflowed an INT2column. Use a larger integer column.Why?@SortType = 7, 8. These are description fields varchar(5000)Syntax error converting the varchar value '<snip>' to a column of datatype smallint.Again, why?All other sort types are fine.What I'm thinking is that when the ORDER BY code is run, it does someconversion but what?Many thanks in advance if anyone has any ideas?Sam
View 3 Replies
View Related
Sep 26, 2007
A colleague of mine has discovered some behaviour in the XML Source component that I am having trouble understanding or explaining. Here is the (obfuscated) XML document that we are looking to parse:
<?xml version="1.0"?>
<ArrayOfWellPatternAssociation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<WellPatternAssociation OfficeCode="Office ABC" PatternName="18 0500" API14="04029597380001" ActiveIndicator="I" AllocationToPattern="0.50" />
<WellPatternAssociation OfficeCode="Office ABC" PatternName="18 0500" API14="04029632710001" ActiveIndicator="I" AllocationToPattern="1.00" />
<WellPatternAssociation OfficeCode="Office ABC" PatternName="18 0500" API14="04029632910001" ActiveIndicator="I" AllocationToPattern="0.50" />
<WellPatternAssociation OfficeCode="Office ABC" PatternName="18 0500" API14="04029632930001" ActiveIndicator="I" AllocationToPattern="0.33" />
</ArrayOfWellPatternAssociation>
When we use the 'Generate XSD...' button it comes up with the following schema:
Code Snippet<?xml version="1.0"?>
<xsd:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://Chevron.UpstreamSolutions.Nau/CommonReferenceData/CommonReferenceData/">
<xs:element name="ArrayOfWellPatternAssociation">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="WellPatternAssociation">
<xs:complexType>
<xs:attribute name="OfficeCode" type="xs:string" use="optional" />
<xs:attribute name="PatternName" type="xs:string" use="optional" />
<xs:attribute name="API14" type="xs:unsignedLong" use="optional" />
<xs:attribute name="ActiveIndicator" type="xs:string" use="optional" />
<xs:attribute name="AllocationToPattern" type="xs:decimal" use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xsd:schema>
I'd like to draw your attention to the bit I've highlighted in red. SSIS has incorrectly defined this attribute as an unsignedLong. if you look at the data above you'll see that it has leading zeros therefore we need it to be interpreted as a string. Unfortunately (and here's the problem) there doesn't seem to be a way for us to change the generated xsd and thus refresh the external column metadata. The only way to change it is to go into the Advanced Editor and manually change the external column and output column metadata.
Is this by design? It seems very limiting if you ask me to not let us have control of what the metadata should be.
If I'm missing something please let me know.
Thanks
Jamie
View 16 Replies
View Related
Apr 13, 2007
Hi everyone,
Primary platform is XP Pro Sp2. Sql25k sp1.
I€™ve got a ForEach container which uses a Foreach ADO Enumerator.
Inside which I have several sql tasks and one Script Task.
Once I launch debugger engine going to VSA and on the right side I see six references to ScriptTask
ScripTask_xnxnxnxnxnxnxnxnxnx
..
..
..
After that, appears this error:
Sql Server Script Task has detected an error and it should be closed€¦
Once there you can start just-in-time debugger:
System.Runtime.InteropServices.COMException was unhandled
Message: File position not valid for new breakpoint.
In a fact, I can follow debugging the execution but I€™m concerned about this behaviour in production environment.
PrecompilescriptintoBinaryCode is false. How odd, I€™ve done other scripts and never happened something like that.
Thanks in advance and regards,
View 7 Replies
View Related
Oct 17, 2006
Dear all,
I've got a SSIS package which comprises a pair of Sql Task and after that a Data Flow.
Such Data Flow own two Data Viewers, one between my Excel Source and my Derived Column and the another one between my Derived Column and my Ole DB Destination. Up to here, everything's fine.
Package really works properly but when I execute only the first Sql Task runtime shows (as usual) Excel Source Ouput Data Viewer1 and Derived Column Output Data Viewer1. Both windows empty, of course. Problem comes when I choose 'Copy Data'. Inmediately, appears a dialog with the message:
"Windows has encountered a problem and needs to close"
I wonder, at first, why on earth these two windows are showed when I execute a task which belongs to Control Flow no Data Flow????? What happen?
Maybe my doubt is a little bit devious, crazy.
Thanks in advance for your input,
View 6 Replies
View Related
Feb 28, 2008
Hi All,
I defined a report based on a matrix having 3 field groups. I defined Interactiveheight to have fixe number of rows in HTML rendering. My problem is that this parameter is only taken into account after first page. My first page always breaks after end of first field group + 1 row of next group.
Do you have any idea, what's causing such behaviour? And what would be the solution?
Thanks
View 9 Replies
View Related
Jul 25, 2007
Hi,
I have a VB6 front end connecting to SQL Server 2005 using the SQL Native Client.
When I execute a stored procedure the returned recordset contains more fields then it should. These extra fields seem to be the fields that the tables are joined on.
This happens with every stored procedure(simple to complex).
If I change the ODBC to use the standard SQL Server driver it works fine.
Any ideas on why this is happening?
View 9 Replies
View Related
Jun 30, 2006
Under Management Studio, when I right-click a stored proc, select Modify, change the stored proc, then select Execute, the stored proc is updated on the server. But then I noticed that the sql tab holding the changed stored proc (in the right pane of Management Studio) still diplays and asterisk (*). When I right-clicked the tab it offeres the Save option but that is to save the sql file (with the * in its tab) to a file. This is confusing behaviour.
Is there any way to change this behaviour so running Execute causes the (*) to disapeear?
TIA,
Barkingdog
View 1 Replies
View Related
Dec 10, 2007
Hi all ,
We had a SQL server (2005) that was performing very bad . We thought of doing an UPDATE STATISTICS thinking that the response times would increase.
BUT , UNFORTUNATELY THE SERVER PERFORMANCE BECAME WORSE FROM BAD.
Ex : Stored procedures that took 2 minutes are running for 22 minutes now. Queris that ran for 17 seconds are running for 14 minutes now.
Anybody faced this kind of issue earlier ? Any help would be appreciated.
Thanks & Regards,
DBLearner
View 2 Replies
View Related
Dec 21, 2006
Hello to everybody. I am experiencing a strange behaviour of Report Builder. I have an AS2005 database with a cube with calculated members (all measures calculation). In the client application they need to see only the calculated members so I setup the visible option to "false" for all the others measures. If I browse the cube with browser of AS I have no problem, I can see the data in any shape possible. To give an example I have a report that shows for each Store how many visitors I received each month. The report has the store in the rows and the months in the columns.
If I try to create the same reports with Visual Studio 2005 I have no problem either. Everything works fine. After doing these test I build up a model for the report builder. I connected to the report builder and I tried to create the same report and I got this message: "No data was found that matched your report criteria". After that error I need to create a new report and start all over again. If I create a simple report with just the store and the number of visitors I do not have any problem.
Any suggestion?
Thank you very much
Andrea
View 1 Replies
View Related