Strange Problem With SQL Server - Auto-numbers Skipped
Mar 15, 2007
Hi There,
I am having a strange problem with my identity column......
1). I have a table of Products that have an identity column auto-incremented by 1.
2). I have my asp program working quite well in which the Data entry operators are adding the products into my database..... and they do not have any interface through which they can delete products........
3). My Database is running at Web server(MS SQL Server)
My problem is that when i cehcked my database.... there were around 1000 records but the auto increment number have reached to 1500. and when i checked in details then i saw that Auto number column is being skipped certain numbers..... like one entry is 1478 then the next one comes to be 1482..... and 1508 to 1516........ Its happening alot of times and it seems that SQL Server is skipping some numbers............
Since it is Auto-Number so i do not have control over it through my code.... So i think the coding might not be the problem...... I have set Identity seed as well as Identity Increment both to 1.
Is there any thing that you can suggest me to do??
(Thanx)
View 12 Replies
ADVERTISEMENT
Jul 23, 2005
I am using sybase aSE12.5. I have a table with only one column withdatatype char(2). when i query this table to select all the records, ishould get these records in the ascending order and they should be numbered, i.e, the o/p should look something like thiscolumn_name------ --------1 AB2 AC3 ADand so on.I cannot add an extra column and i need this to be done in a single query.--Message posted via http://www.sqlmonster.com
View 2 Replies
View Related
May 25, 2005
Hi,Please can you let me know the best solution for creating a primary key which automatically increments by 1 each time a record is added. My current Primary key is of type "Int" which increments by 1 each time, but I would like my primary key to contain "ABC" before the 1. So each time a record is added I would like to see:-ABC000001 ABC000002ABC000003Etc, EtcI am using SQL Server 2000 and creating an ASP.Net application, will I need to write code in a Stored Procedure to do this?Regards,Brett
View 4 Replies
View Related
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
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
Jun 15, 2015
I have a database that has entries that I want sorted by date order. Each entry has an auto ID number allocated (primary key auto sequencing), which I want to change to reflect the sorting (so the first date has the first auto ID number and so on).I've gone into the database and sorted the entries as I want them. Then I've gone into Design View to delete and restablish the primary key autosequence. However, it is not keeping the date order in the database (ie entry ID 3140 date is 12/06/2015, but 3141 is 02/02/2012). How do I get it to maintain the order?
View 3 Replies
View Related
Feb 1, 2007
I have a report with a column which contains either a string such as "N/A" or a number such as 12. A user exports the report to Excel. In Excel the numbers are formatted as text.
I already tried to set the value as CDbl which returns error for the cells containing a string.
The requirement is to export the column to Excel with the numbers formatted as numbers and the strings such as "N/A' in the same column as string.
Any suggestions?
View 1 Replies
View Related
Sep 11, 2006
I imported a table using DTS.
I run SQL statements in my original server database. It works well.
But when I run the same instructions within a stored procedure in my new workstation where I improrted the table I get this error:
Server: Msg 515, Level 16, State 2, Procedure InsertFichierPrix, Line 11
Cannot insert the value NULL into column 'Id', table 'myDBLive.dbo.FichierPrix'; column does not allow nulls. INSERT fails.
The statement has been terminated.
Here is the SQL statements that I run on the original Database:
insert into fichierprix(nomfichier, version, descriptionfr, typeclient,....) values(@NomFichier,'Actuelle', @NomFourFr, 'MembreAcheteur', ....)
And here is my SP that I run on the new imported database:
CREATE PROCEDURE InsertFichierPrix @NomFichier varchar(50), @NomFr varchar(50),@NomAn varchar(50)
AS
declare @NomFourFr varchar(50)
declare @NomFourAn varchar(50)
SET @NomFourFr='liste fournisseur ' + @NomFr
set @NomFourAn='liste fournisseur ' + @NomAn
insert into fichierprix(nomfichier, version, descriptionfr, typeclient,...) values(@NomFichier,'Actuelle', @NomFourFr, 'MembreAcheteur'...)
GO
And here is the execution of my Stored proc on the destination database:
execute insertfichierprix @NomFichier='myfilename2', @NomFr='fournifr1',@NomAn='Fourniang1'
Thank you for helping me.
View 2 Replies
View Related
Oct 22, 2007
One of my application i am using is very slow,(SQL 2005 backend).I am trying to find out the tables and add index to it.But this time my profiler is skipping the records(Trace Skipped Records).Is there any settings?,so that it shows up all the records.
Note: i dont have the code of the application,but i can find few tables holding 2-3 millions of records.I want to know the column name,to create index.
View 8 Replies
View Related
Jun 28, 2002
Can someone please help in in understanding what I have done wrong. My company is using Backup Exec 7.3 as it's back up application. I have built a server, installed SQL, Built an database and added logins. I am backing up my database and Transact Log Files to specific folders on my partioned drive. Why when I run the backup ups, It backs up everything EXCEPT for my SQL folders. It seems to Skipp all SQL Folders. Please Help, I need to have this funtion working properly. What have I done wrong or what do I need to do to make this stop. Does this perhaps have something to dwil Here is an example of the backup Message in Backup Exec that I am recieving:
Media Name: "DIFF"
Backup of "FEPTESTE$ "
Backup set #41 on storage media #1
Backup set description: "Daily 6"
Backup Type: DIFFERENTIAL - Changed Files
Backup started on 6/28/02 at 12:36:21 AM.
The item Microsoft SQL ServerDataMSSQLDataTESTDB_Data.MDF in use - skipped.
The item Microsoft SQL ServerDataMSSQLDatamaster.mdf in use - skipped.
The item Microsoft SQL ServerDataMSSQLDatamastlog.ldf in use - skipped.
The item Microsoft SQL ServerDataMSSQLDatamodel.mdf in use - skipped.
The item Microsoft SQL ServerDataMSSQLDatamodellog.ldf in use - skipped.
The item Microsoft SQL ServerDataMSSQLDatamsdbdata.mdf in use - skipped.
The item Microsoft SQL ServerDataMSSQLDatamsdblog.ldf in use - skipped.
The item Microsoft SQL ServerDataMSSQLDataorthwnd.ldf in use - skipped.
The item Microsoft SQL ServerDataMSSQLDataorthwnd.mdf in use - skipped.
The item Microsoft SQL ServerDataMSSQLDatapubs.mdf in use - skipped.
The item Microsoft SQL ServerDataMSSQLDatapubs_log.ldf in use - skipped.
The item Microsoft SQL ServerDataMSSQLDataempdb.mdf in use - skipped.
The item Microsoft SQL ServerDataMSSQLDataemplog.ldf in use - skipped.
The item Microsoft SQL ServerDataMSSQLLOGTEST_Log.LDF in use - skipped.
Backup completed on 6/28/02 at 12:37:11 AM.
Backed up 48 files in 24 directories.
14 items were skipped.
Processed 23,876,604 bytes in 50 seconds.
Throughput rate: 27.3 MB/min
View 1 Replies
View Related
Sep 5, 2013
I have a serious issue with transferring binary(8) data from SQL Server 2008 R2 to Excel 2010.
A standard query is made in Excel (Data -> From Other Sources -> From SQL Server) and it works... almost perfect.Almost, because in the query result I have almost all columns in destination spreadsheet, except of those columns which are binary(8) format in my table in SQL Server.
So, in SQL there are columns - let's say:
Date
Start time
End time
User ID (as binary(8) format)
Memo (as string)
...
After Excel's query is done, in Excel there are only columns:
Date
Start time
End time
Memo (as string)
...
All columns with types = binary(8) are skipped.
I tried:
1. Export from SQL Server to CSV file and then from CSV file to Excel (all columns as string) and it works, but it has to be automated so CSV is not a good idea.
2. Adding to ConnectionString additional parameters NO_BINARY_RESULT=1 - does not work.
3. Adding to ConnectionString additional parameter IMEX=1 - does not work.
View 10 Replies
View Related
Feb 11, 2008
What causes SQL Profiler to show "SQL Profiler Trace Skipped Records"?
SQL2005 SP2 64bit
Thanks.
View 3 Replies
View Related
Dec 7, 2006
We've set up transactional replication to continue on data consistency errors and we do see in the replication monitor that records are skipped at the subscriber. Our subscriber is SQL2K and our publisher is SQL2K5. How can we see the records that were skipped and why they were skipped.
View 4 Replies
View Related
Jul 20, 2005
Why does M$ Query Analyzer display all numbers as positive, no matterwhether they are truly positive or negative ?I am having to cast each column to varchar to find out if there areany negative numbers being hidden from me :(I tried checking Tools/Options/Connections/Use Regional Settings bothon and off, stopping and restarting M$ Query Analyer in betwixt, butno improvement.Am I missing some other option somewhere ?
View 7 Replies
View Related
Nov 17, 2007
I tried to load a fixed width flat file with around 300,000 rows. However, only the first 8xxxx rows were loaded to the destineation table and the rest row were loading blank records. There was no error message showing during package execution. I've tried to split the file in half and the result was the same. So it wasn't the data file problem.
Would there be any buffering issue I need to cater for inside the package? Thanks!
View 10 Replies
View Related
Mar 11, 2008
I have a table with a column ID of ContentID. The ID in that column is all NULLs. I need a way to change those nulls to a number. It does not matter what type of number it is as long as they are different. Can someone point me somewhere with a piece of T-SQL that I could use to do that. There are over 24000 rows so cursor change will not be very efficient.
Thanks for any help
View 6 Replies
View Related
Aug 27, 2015
I am copying the template with header before loading the data. I tried deleting Dataflow task, Excel Connection manager etc., nothing seems to work and there are no nulls in the data. I did this several times, workaround seems to not working this time.
View 9 Replies
View Related
Feb 16, 2014
Since upgrading from SQL Server Management Studio 2008 R2, I've noticed that it no longer autosaves queries that have not been manually saved first. If a file has been manually saved the autorecover files end up in the following directory:
%appdata%MicrosoftSQL Server Management Studio11.0AutoRecoverDatSolution1
However, I have ended up in the situation where I have unsaved queries when my computer has crashed and have not been able to recover them.
I have also found references to .sql files stored in temp files in the following directory, but the files here seem to be very haphazardly caught:
%userprofile%AppDataLocalTemp
View 2 Replies
View Related
Feb 21, 2007
I have an 'ID' column. I'm up to about ID number 40000, but not all are in use, so ID 4354 might not be in any row. I want a list of all numbers which aren't in use. I want to write something like this:
select [numbers from 0 to 40000] where <number> not in (select distinct id from mytable)
but don't know how. Any clues?
View 1 Replies
View Related
Mar 27, 2007
I'm trying to write data to excel from an ssis component to a excel destination.
Even thought I'm writing numerics, every cell gets this error with a green tag:
Convert numbers stored as text to numbers
Excel Cells were all pre-formated to accounting 2 decimal, and if i manually type the exact data Im sending it formats just fine.
I'm hearing this a common problem -
On another project I was able to find a workaround for the web based version of excel, by writing this to the top of the file:
<style>.text { mso-number-format:@; } </style>
is there anything I can pre-set in excel (cells are already formated) or write to my file so that numerics are seen as numerics and not text.
Maybe some setting in my write drivers - using sql servers excel destination.
So close.. Thanks for any help or information.
View 1 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
Nov 8, 2007
Hi All,
I am using sql server 2005. I stuck out in a strange problem.
I am using view in my stored procedure, when I run the stored procedure some of the rows get skipped out means if select query have to return 10 rows then it is returning 5 rows or any other but not all, also the records displyaing is randomly coming, some time it is displaying reords 12345 next time 5678, other time 2468.
But if I run seperately the querys written in SP then it returns all the rows. Please give me solution why it is happening like this.
There are indexes in the tables.
Once I shrink the database and rebuild the indexes, from then this problem is happening. I have rebuild the indexes several time, also updated the statistics but nothing improving.
But nothing is improving
View 7 Replies
View Related
Aug 23, 2000
I restored a development database to a test database on the same server. I thought this would be a good
thing to do because testers would have the same data as developers and the tables would be exactly alike.
However, I noticed that the object_id is identical for the tables. For example, the Accounting Calendar in the development
database and the Accounting Calendar in the test database have the same Object_id. Could anyone verify that
this is or is not going to cause me trouble?
View 4 Replies
View Related
Jan 6, 2004
I'm trying to take data from a form and insert it into a SQL database. Everything works fine until I try inserting a number with the comma separator in the number field. The data type in SQL is integer. Are there any special settings to get SQL to accept a comma separated number using ASP?
View 4 Replies
View Related
Mar 25, 2004
Is is possible to Generate sequence numbers in a Query result in an SQL select Statement
like
Select sno,employee_name from empmaster
sno being a number with auto increments(this Field will not be in a Table).
I do not want to use Identity .....
This is Just to Provide a Serial Number to the Query Output...
thus the Out put should be something like
sno employeename
--- ------------------
1 abc
2 jhjk
3 kljl
View 4 Replies
View Related
Apr 13, 2007
i m using sql server 2000. My problem is tht no matter what date i enter, sql server always displays it as
1900-1-1. This is happening on all columns which have been specified as datetime. Whts the problem & the solution to the problem?
View 3 Replies
View Related
Sep 19, 2006
recently I am enhancing an PPC application using VS 2005. I decide to use sql ce 2.0 cuz the old system is using this version.
I am using the SqlCeEnging to create a new database, and create two tables: TableA and TableB.
Inside the two tables, there are few fields without any primary key or index. Of course I dint insert any data so far.
Below is part of my coding.
query="Select * From TableA Where Con1=? And Con2=?"
SqlCeCommand cmd = new SqlCeCommand();
cmd.Parameters.Add("@Con1", SqlDbType.Float);
cmd.Parameters.Add("@Con2", SqlDbType.Float);
cmd.Parameters["@Con1"].Value = con1;
cmd.Parameters["@Con2"].Value = con2;
cmd.Connection = cn;
cmd.CommandText = query;
cmd.Prepare();
Here system return me some strange error: The specified table does not exist.
I am very sure that the table is already created and I dun know what' wrong with the sql ce 2.0.
Hope anybody can help me.
thanks a lot.
View 1 Replies
View Related
Feb 13, 2008
I get this SQL-sever error in my application. I guess it has something to do with the declaration of namespaces? Does anyone know for sure? Thanks in advance!
The type 'System.Data.Selclient.SqlConnection' exists in both
'c:WINDOWSMicrosoft.NETFrameworkv2.0.50727System.Data.dll' and 'crogramMicrosoft Visual
Studio 8Common7IDEPublicAssembliesSystem.Data.SqlClient.dll'
View 11 Replies
View Related
Aug 19, 2007
I have a script that creates a database and sets up everything required for merge replication. Merge replication is pull with a single parameterized row filter based on HOST_NAME() and joins on other tables. It works perfectly.
I recently decided to drop all my identity columns and use rowguid's instead.
I modified my script by only changing the primary key column definitions, basicaly I went from "[Id] [int] NOT FOR REPLICATION IDENTITY (1,1) NOT NULL PRIMARY KEY CLUSTERED" to "[Id] [uniqueidentifier] ROWGUIDCOL NOT NULL DEFAULT NEWSEQUENTIALID() PRIMARY KEY CLUSTERED".
The script still works fine. Everything is executed succesfully and even the snapshot agent finishes it's job.
But the problem is, that when I want to create a partition I get the following error:
A value for the parameter @host_name was specified, but no articles in the publication use HOST_NAME() for parameterized filtering. (.Net SqlClient Data Provider). Microsoft Sql Server, Error: 20672
If I try to synchronize a subscription then the subscription is created succesfully, but I get an error while synchronizing stating:
Merge agent was unable to determine if another subscription exists for the current partition.
And yes, I do have my filters set up 100% correctly.
The funny thing is, if I create the publication via Management Studio, then I don't get that error.
But if I create the publication via Management Studio, immediately afterwards generate the script for it, delete the publication and create the publication from the generated script, I get the error again
From this I have concluded that no way can the problem be in my new script...
Everything is dandy fine with the server as well, because the original scipt still works flawleslly.
Does anyone have any ideas what I could try to get things working?
Has anyone even gotten merge replication set up via script, while database -> uses only rowguids, hostname parameterized filter and joins?
Or should I just report this as a bug to Microsoft and go back to my original script, including the identity hell?
PS! I'm using Windows Server 2003 Standard x86 SP2, SQL Server 2005 Standard x86 SP2
View 7 Replies
View Related
Jul 14, 2004
Has anyone seen the SQL Server error:
"tempdb is skipped. You cannot run a query that requires tempdb"?
We're running a .Net web application with a SQL Server 2000 backend, and we get the error intermittently. Restarting the SQL Server service seems to fix it, as it causes tempdb to be rebuilt, but this isn't a long term solution. Any direction or hints would be greatly appreciated. Thanks!
- Mike
View 11 Replies
View Related
Nov 27, 2006
I am trying to use a condition in a query with CTE but I got an error.It is simple enough but I just cannot get it work. Any help will be greatly appreciated!
Msg 156, Level 15, State 1, Line 8Incorrect syntax near the keyword 'if'. declare @i as int
set @i=1;
with CTE_A as
(
select 'B'
)
if @i=1 ---this part get problem
select * from CTE_A
else
select 'B'
View 2 Replies
View Related
Nov 16, 2007
I have web app and it is workin perfectly when i hawe SqlExpress started even if my database is in SqlServer (is that maybe that i did try membership provider if so how can i remove membership.) so i dont know how to solve this problem without using SqlExpress..
Can some one pleas help me.
"1.0"?>
"system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
"scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
"scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
"webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
"jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
"profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
"authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
"sqlcon" connectionString="SERVER=MySQLSERVERSQL7557;DATABASE=SFE;UID=sa;PWD=;Timeout=10000;MultipleActiveResultSets=true">
"Forms">
"asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
"true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
"true">
"System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
"System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
"CrystalDecisions.CrystalReports.Engine, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
"CrystalDecisions.ReportSource, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
"CrystalDecisions.Shared, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
"CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
"CrystalDecisions.ReportAppServer.ClientDoc, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
"CrystalDecisions.Enterprise.Framework, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
"CrystalDecisions.Enterprise.InfoStore, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
"*" path="*.asmx"/>
"*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
"*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
"GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
"GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
"ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
"false"/>
"ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
"WebServiceHandlerFactory-Integrated"/>
"ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
"ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
"ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
"true" inheritInChildApplications="true">
-->
Sorry for my bad english
View 2 Replies
View Related
Feb 7, 2005
Hi,
I got a strange sql 2000 problem, Im using:
DataAdapter.Fill(dataset,"user")
Dim test as String = dataSet.Tables("user").Rows(0).Item("test")
It works fine, but after 6-7 hours it gives me this error: Column 'test' does not belong to table user
I have to reset Asp worker processes to make it works again, but after 6-7 hours it crashes again.
Any ideas?
View 1 Replies
View Related