ReorderList, Database, Identity Questions
Jan 12, 2008
Hi Guys,
The ReorderList control has driven me to desperate ends tonight. I found that it will only work if my database has a field (OrderID in this case) of type int that it can use to keep track of the order. The problem is that I'm not using the ReorderList control for inserting into the database. This requires me to keep track of the OrderID myself and I have found that simply setting the OrderID field as the "Identity" will cause it not to work.
Common sense tells me that using the Identity is the best way to keep track of a ReorderList because it automatically numbers things as ther're inserted. If something is deleted, it shouldn't matter because it will still be in order even to there's a gap in the numbering.
The only solution I can think of is trying having TWO identity fields in the database, but since that's not possible, a field that mirrors the Identity. Can anyone advise me on how to do that? The below datasource does not insert anything into the OrderID field:
<asp:SqlDataSource ID="sdsItems" runat="server" ConnectionString='<%$ ConnectionStrings:testConnectionString %>'
SelectCommand="SELECT * FROM [Items]"
InsertCommand="INSERT INTO [Items] ([Name]) VALUES (@Name) SET @OrderID = SCOPE_IDENTITY()"
UpdateCommand="UPDATE [Items] SET [Name] = @Name, [OrderID] = @OrderID WHERE [ItemID] = @original_ItemID"
OldValuesParameterFormatString="original_{0}" DeleteCommand="DELETE FROM [Items] WHERE [ItemID] = @original_ItemID">
<InsertParameters>
<asp:Parameter Name="Name" Type="String" />
<asp:Parameter Direction="Output" Name="OrderID" Type="Int32" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="Name" Type="String" />
<asp:Parameter Name="OrderID" Type="Int32" />
<asp:Parameter Name="original_ItemID" Type="Int32" />
</UpdateParameters>
<DeleteParameters>
<asp:Parameter Name="original_ItemID" Type="Int32" />
</DeleteParameters>
</asp:SqlDataSource>
View 1 Replies
ADVERTISEMENT
May 15, 2006
My client has a need for the auto identity field to be 6 digits in length starting with the number 001000. They want the leading 0's preserved since this will be a casenumber. Even if I set the identity seed to 001000 it gets rid of the leading 0's. How can I get it to keep those?
View 1 Replies
View Related
Jul 20, 2005
We are negotiating with a vendor and we have a few questions:1) From a licensing point of view, what is a database? Can we installmultiple copies of SQLServer on one box? In that case, would eachcopy be a different database?2) Within a single SQL Server installation, I can create multipledatabases, as listed in the Enterprise Manager. I can switch amongthem using "use ..." commands. Would these be treated as differentdatabases?3) We have copies of our transactional database in identicaldevelopment, QC, and production environments. Is this a singledatabase, or 3 databases?
View 3 Replies
View Related
May 17, 2008
Hey guys, this is my first post here. I just joined recently and I am loving the videos as they've really helped me step into ASP.NET and VB. Just some background, I used to be a CS major several years ago and programmed in Java and C, though I only went through 2 years before I moved majors. I didn't like the focus of my universities program, and decided to pursue other options. Ironically, I am now delving back into programming, but with a focus on web development, hence learning VB and ASP.NET. Anyways I am developing my first web application and I needed some help.Basically, what the program does is allow users to login to this web site and then store private information, which they can then access at a later time from any computer that is connected to the web. I have already setup user membership by following the video (lesson 8 of the ASP.NET series - Securing your Web site with Membership and Login Controls) from the Learnvisualstudio.net series. I can login to my site just fine, as well as creating a new user etc. The next step is designing the SQL database, and setting up the page that retrieves a users data, allowing them to view the private information they've stored, as well as to edit, create, and delete information.Unfortunately, while I can see the broad method of doing this, I am a bit lost in actually implementing it. The first stumbling block I am coming across is the SQL database itself. I have attached an image of how I have the database designed so far. Note that the aspnet_user table is the one that ASP.NET creates automatically when you enable membership controls and such.So basically, a user logs in, and they are greeted with a list of all of the "stickies" they have created. Each sticky has a title, as well as up to 4 fields, and you can enter the name of the field, as well as enter the actual data. It's foreign key ties back to the UserId that ASP.NET already created. The user can also organize their stickies into categories, hence that table. The Settings table will be where a users settings will be saved, such as which view mode they prefer etc. At this stage of development, that table is un-important and un-developed.So on to some of my questions. As it is designed now, there will be one table with every users stickies, as well as categories, and when a user logs in, the program will look at the category and stickies tables, and grab the ones that are associated to the users UserId. So one of my first questions is; is this a good design? I ask this from a security standpoint as well as a speed and efficiency standpoint. I want this site to be able to support at least 50,000 to 100,000 users, each with any number of "stickies" and "categories" With that size of a user base, would each user be looking at massive load times because the program would have to go through a very large table to grab only the ones that are linked with the users UserId? Say I have 50,000 users, and each user has 5 "stickies", that means that my user_stickies table would have 250,000 rows of data, and the program would be trying to find only 5 of those. Is this a really inefficient way of doing this? Should each user have their own category and stickies table? If so, how would I go about doing this? And in that case, instead of having a couple giant tables, my SQL DB would instead have a ton of tables, is this even any better?I have other questions, but I guess I'll start with this. What are your guys' thoughts? I am a newbie, so this may be a silly set of questions. I try to read up and research as much myself as I can, but sometimes you have so much information thrown at you at once its hard to grab out the specific answers you need.
View 4 Replies
View Related
Dec 6, 2004
I’m trying to design a database that allows the users to give each individual client/company unlimited addresses and salutations. I can build the design that accommodates this, but I cannot figure out how to handle them knowing which salutation to use with a mailing they might do to the clients.
I have put the Company Name and Position (title) in the address table so that when doing a mailing the company name and title are associated with the company address being mailed too. But again, I’m not sure how they would choose a salutation if they have many choices.
Looking for any of your thoughts or suggestions.
Thank you,
View 1 Replies
View Related
Jan 19, 2004
Hi,
I designed the database and there are two points I'm not sure that my design was correct:
1) In my search engine (in interface) i have an expression builder and user can save the expression he created. In this case don't chreate view in database, but I have a table named "Expressions" which saves expression name and expression. The reason I made it was: If I create view it doesn't make db to work faster because the select query in view runs every time when view was opened, but it makes my code more generic . But isn't it a design error?
2) I save 3 reserved fields in each table, and I don't know if I'll use them some day. The reason: adding a column to database is heavy operation. But isn't it a design error?
Thank you for advice
View 4 Replies
View Related
Apr 24, 2007
I have a few questions here about designing a database:
1. What is normalisation and de-norminalisation?
2. A quote:
normalisation has a series of steps (or rules) called forms the more steps you take, the more normalised your tables are......If you use the first 3 steps you would say that the tables are in their Third normal form
What is all that about - whats forms got to do with tables or what is he trying to say in the above quote?
3. When would you decide to create a new table in a database - i.e. what rules does everyone follow to say "ok i better capture this data in a new table and create a relationship to another table"
Thanks in advance
View 6 Replies
View Related
Oct 2, 2007
Hello,
I'm new to databases but not to programming in general. I've got a few applications which currently sit on a single PC and read/update a particular XML file on the box. The applications are C# apps and use FileSystemWatchers and a mutex to keep watch for changes and update the XML file as needed. It has worked reasonable well for me.
Now, I need to run these applications on separate machines, so it seemed a good point to consider moving toward a database solution.
I'm hoping that there is a straightforward solution using SQL Server that will ensure that my applications alway have the current view of the world. I had run into instances with my existing setup where once in a while an application thought its DataSet was up to date, but wasn't.
Can someone point me in the right direction to implement the solution? I suspect that this is a really common need for lots of programs that are distributed. I'm still quite a newbie with databases and SQL Server, so I'm not even sure I'm using the right terms to describe things.
Thanks,
Matt
View 1 Replies
View Related
Apr 19, 2007
Hello Gurus,
I wanted to restore a database to multiple data files from backup which has got only few data files. Is it possible do this?
Example : Backup has 4 data files and I need to restore it to 8 data files.
Thanks
Subbu
View 1 Replies
View Related
Jan 31, 2006
Our company is looking to move to a more robust database platform/setup, and it looks like sql 2005 + database mirroring is what we are looking for. First I have some questions about it.
Can a server that is functioning as a mirror for one database be the primary server for a seperate database? Basically think of a triangle of three sql servers, each serving as a primary server for a specific database, and using the next server in the triangle as a mirror for that specific database. To be more specific:
Server 1, Primary Database A, Mirroring Database C
Server 2, Primary Database B, Mirroring Database A
Server 3, Primary Database C, Mirroring Database B
If that is possible, how many witness servers would be needed to accomplish the above topology? On that note, how robust hardware wise should the witness server be?
On a completely seperate note, what method is recommended for interconnecting these servers? Is gigabit ethernet fast enough, or does it require something like fibre channel or infiniband?
Thank You!
View 1 Replies
View Related
Aug 8, 2006
I have a db in SQL server 2000 developer edition. I am using Visual Studio 2005 standard, and also VWD Express. I would like to just access the database that is in SQL server 2000 so I can get on with developing the site, but VS2005 refuses to recognize the instance. It recognizes 2005 instances right away.The services are all running, the network protocols are enabled, uid's/pw all of that is correct. I am getting the "named pipes" error (the named pipes protocol is enabled).Any suggestions? I'd really rather just work with the db as-is in SQL 2000. But I can't get it to connect. I can connect to it if I export it to SQL 2005, (on the same development machine) but can't get the stored procs over to the 2005 db. So my web app is not finding the stored procs and won't run.Do I need to uninstall SQL 2005 from this box if I want to use SQL 2000?Thanks,--Donnie
View 13 Replies
View Related
Aug 22, 2005
I have an ODBC 3.0 Application on Windows NT Server maintaining aconnection to a SQL Server 2000 database on the same machine. When anerror occurs, I'd like to be able to determine whether the error isserious enough that the database connection has been lost, so I canhave the application try to reconnect automatically. My understandingis that any error of severity 20 or above includes a broken connection,but I'm having difficulty retrieving the error severity through ODBC.So my first question is, how do I retrieve the error severity throughODBC?Also, as a test, I stopped the database while my application is stillrunning, and the first error I received had a native error code of 55.There is no 55 error in the sysmessages table, so I'm confused as towhat the severity of the error is. Can anyone shed some light on why Iwould be receiving an error code that is not in the sysmessages table,and where I might be able to find more information about the error?Thanks in advance,Abram
View 2 Replies
View Related
Aug 28, 2007
All,
We have SQL 2005 db mirror configured with a witness server for high availability. Node 1 is the principal and Node 2 is the mirror. A nightly job creates a snapshot on Node 2. The snapshot is used for previous day reporting queries. We have now been asked to present another copy of the database for near-time reporting. I thought about possibly adding a peer-to-peer replication as part of my environment but was hoping to see what everyone else out there is doing.
Regards,
Ian
View 1 Replies
View Related
Nov 23, 2006
I have a SQL Server 2005 database (called BDHSE) in a PC which i call PC1. I have a second PC (PC2) and both are within a network (a WLAN).
What i want is to have access to BDHSE from an application in VB6 (APP1) running in PC2. All the INSERT, DELETE, UPDATE records process is done through APP1.
APP1 ia currently running in PC1 and is to be installed on PC2.
I have these questions:
1. What do i need to install in PC2 since all the INSERT, DELETE, and UPDATE is done using APP1? I guess i only have to install the Microsoft SQL Native Client (with all the prerequisites of course) but i am not sure.
2. In the APP1 made in VB6, do i have to change the connectionstring since i am accesing the database which physically is at PC1 and the APP1 will be used in PC2?
3. Any advice you can give me on doing this will be well received.
Thanks in advance,
BSc Fernando Martinez
View 4 Replies
View Related
Jan 11, 2008
Here's my scenario. I've got an web site that is going to allow access across two different domains. So I pull out the user name and domain with a split. At that point I want to say If user name = a value in bug_user table then redirect ~default.aspx Else redirect to other page. I'm kind of stuck. Here is what I got so far. Imports System.DataImports System.Data.SqlClientPartial Class MasterPage Inherits System.Web.UI.MasterPage Sub page_load() Dim user As System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User Dim username As String username = user.Identity.Name Dim namer As String Dim domain As String Dim firstname As String namer = username.Split("")(1) domain = username.Split("")(0) Dim objcon As ConnectionStringSettings = ConfigurationManager.ConnectionStrings("bug_trackerConnectionString") Dim str As String = objcon.ConnectionString Dim con As New SqlConnection(str) Dim com As New SqlCommand("", con)?????????????????????????? con.Open() com.commandText = "Select FirstName, LastName, Userid, Domain from bug_user" con.Close()??????????????????????? Between the question marks is where i start to get lost. I don't know how to look into the column Userid in the table bug_user table to see if my variable namer is present and I don't know where I should start my if statement. Thank for your help.
View 1 Replies
View Related
Oct 4, 2007
Hello
I am creating a TABLE
CREATE TABLE [dbo].[TbTest](
[id_TbTest] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY CLUSTERED ,
[Title] [varchar](100) NULL,
) ON [PRIMARY]
when looking at the Column Properties in MS Server Management Studio I get :
Identity Specification = Yes
(Is Identity) = Yes
Increment = 1
Seed = 1
now if I want to make a copy of that database, importing datas and tables
I get :
Identity Specification = No
(Is Identity) = No
How can I avoid this problem ? my application is not working anymore
ALTER TABLE [dbo].[TbTest] WITH NOCHECK ADD
CONSTRAINT [PK_TbTest] PRIMARY KEY CLUSTERED
(
[id_TbTest]
) ON [PRIMARY]
is not solving that problem
thank you
View 5 Replies
View Related
May 19, 2014
How to merge the data from one database to another if we have identity column on both the database. If we are merging two companies,we need employee table of 2 database and insert them into first database and corresponding fkey tables say some 7 tables.how to merge if the table is having identity column.
DatabaseA has 7 Tables
Namely T1,T2,....T7
DatabaseB has 7 Tables
Namely T1,T2,....T7
T1 is master
T2 is Child
DatabaseA
T1
|
----------------
| |
T2 T3
| |
----------------- ---------------
|| | |
T4T5 T6 T7
DatabaseB
T1
|
----------------
| |
T2 T3
| |
----------------- ---------------
|| | |
T4T5 T6 T7
All the tables have interrelationship as shown pkey and Fkey
All the T1...T7 have Pkey with identity column starting from 1 and corresponding Fkey column in their child tables
Database A Table information Rows
T1-10000
T2-5000
T3-5000
T4-5000
T5-5000
T6-5000
T7-5000
Database B Table information Rows
T1-20000
T2-10000
T3-10000
T4-10000
T5-10000
T6-10000
T7-10000
Now i want to merge all the data from Database B to DatabaseA
How can i merge since in DatabaseA id for T1 starts from 1,2,3,4...and so on...
DatabaseB id for T1 also starts from 1,2,3,4...and so on...
and the fkey tables also have same 1,2,3,4...and so on... with reference of parent table
View 3 Replies
View Related
Apr 14, 2008
I need a script that returns the last identity value generated for each table in a database that has an identity column.
I am using SQL Server 2005.
Thanks.
View 6 Replies
View Related
Feb 1, 2008
I am working with a table in SQL server. I have a column that I want to designateas an identity column. I am not able to do this, because the field for "Identity Specification" is not editiable.
What I did was I went to sql server, right clicked and selected "Modify".The column properties dialog box/edit grid is then displayed with attributesthat I can modify.
There are two major nodes in this dialog box. One is named "General" and the otheris named "Table Designer". I expand the "Table Designer" node and then go to the node labeled "Identity Specification" It is here where I would like to edit thevalues.
The values that are listed for edit are listed below. BUT, the problem is thatI can place my cursor in those fields, but I am not able to change/edit them.Can anyone tell me what the problem is here? and how I can fix it?
+Identity Specification (Is Identity) Identity Increment Identity Seed
View 3 Replies
View Related
Jul 23, 2005
Need help on the Auto Number or Identity Seed on the Oracle DatabaseI got an Access database that need to be converted to Oracle 9i.Somehow the Trigger we created to simulate the "AUTO NUMBER" on Accesscould not create the sequence number as soon as the value has beeninserted. The sequence number can only be created after we go to thesecond line. Please see the trigger below.Is there anyway we could create a trigger that could create thesequence number as soon as we enter a value? It should be verysimilar to the "Auto Number" on Access, or "Identity Seed" on SQLServer.----------------------------------------------------------1. sequence SNP.SECTION_ID_SQ:CREATE SEQUENCE SNP.SECTION_ID_SQSTART WITH 1INCREMENT BY 1NOMINVALUENOMAXVALUENOCYCLECACHE 20NOORDER/GRANT SELECT ON SNP.SECTION_ID_SQ TO "PUBLIC"/2. Trigger SNP.SNP001_T_I_GET_NEXT_SECTION_ID:CREATE OR REPLACE TRIGGER SNP.SNP001_T_I_GET_NEXT_SECTION_IDBEFORE INSERTON SNP.SNP001_SECTIONREFERENCING OLD AS OLD NEW AS NEWFOR EACH ROW WHEN (new.section_id IS NULL)BEGINSELECT section_id_sq.nextvalINTO :new.section_idFROM dual;END;
View 1 Replies
View Related
Jul 9, 2006
While I have learned a lot from this thread I am still basically confused about the issues involved.
.I wanted to INSERT a record in a parent table, get the Identity back and use it in a child table. Seems simple.
To my knowledge, mine would be the only process running that would update these tables. I was told that there is no guarantee, because the OLEDB provider could write the second destination row before the first, that the proper parent-child relationship would be generated as expected. It was recommended that I create my own variable in memory to hold the Identity value and use that in my SSIS package.
1. A simple example SSIS .dts example illustrating the approach of using a variable for identity would be helpful.
2. Suppose I actually had two processes updating these tables, running at the same time. Then it seems the "variable" method will also have its problems. Is there a final solution other than locking the tables involved prior to updating them or doing something crazy like using a GUID for the primary key!
3. We have done the type of parent-child inserts I originally described from t-sql for years without any apparent problems. (Maybe we were just lucky.) Is the entire issue simply a t-sql one or does SSIS add a layer of complexity beyond t-sql that needs to be addressed?
TIA,
Barkingdog
View 10 Replies
View Related
Apr 30, 2008
Hi all,
I am writing a portion of an app that is of intensely high online eCommerce usage. I have a question about identity columns and locking or not.
What I am doing is, I have two tables (normalized), one is OrderDemographics(firstname,lastname,ccum,etc) the other is OrderItems. I have the primary key of OrderDemographics as a column called 'ID' (an Identity Integer that is incrementing). In the OrderItems table, the 'OrderID' column is a foreign key to the OrderDemographics Primary Key column 'ID'.
What I have previously done is to insert the demographics into OrderDemographics, then do a 'select top 1 ID from OrderDemographics order by ID DESC' to get that last ID, since you can't tell what it is until you add another row....
The problem is, there's up to 20,000 users/sessions at once and there is a possiblity that in the fraction of a second it takes to select back that ID integer and use it for the initial OrderItems row, some other user might have clicked 'order' a fraction of a second after the first user and created another row in OrderDemographics, thus incrementing the ID column and throwing all the items that Customer #1 orders into Customer #2's order....
How do I lock a SQL table or lock the Application in .NET to handle this problem and keep it from occurring?
Thanks, appreciate it.
View 2 Replies
View Related
May 30, 2008
Hi all,
I have a SQL Server 2005 Compact Edition database that synchronizes with a SQL Server 2005 Standard database via merge replication.
The problem I have is when I cancel a synchronization, the database is left in such a state that I cannot add any new records. I dug around a bit and have found that in the INFORMATION_SCHEMA.COLUMNS view, AUTOINC_MAX has been incorrectly set to the same value as AUTOINC_MIN for the primary keys, which explains the 'out of range' error I get in my program when running off such a database.
In contrast, a non-corrupted database has AUTOINC_MAX set to AUTOINC_MIN + 999, presumably because of my subscriber identity range of 1000.
If this is the only thing that has gone wrong, all I need to do is programmatically set the AUTOINC_MAX values to AUTOINC_MIN + 999, however I can't find out where to do this (and INFORMATION_SCHEMA.COLUMNS is a view so it can't be updated obviously.)
I have also heard that 'compacting' the database may help, but I don't know how to do this either!
Any help would be immensely appreciated!
Regards,
Jonathan.
View 8 Replies
View Related
Apr 21, 2008
Hi All,
I am new to MS SQL SERVER 2005.
My web application using SQL Server 2005 as back end database to store all the information.
I am using connection pooling to get connection form db.
But my fron end user( user who logged in into webapplication) lost his identity b'coz for database user is application server.
Now I wanna to track front end user in db.
In oracle I can do it by using CLIENT_IDENTIFIER. But in sql server I don't know how to do it.
in oracle i can do it as below
public void setIdentity(Connection conn, String identity) {
PreparedStatement ps;
try {
ps =
conn.prepareCall("begin dbms_session.set_identifier(?); end;");
ps.setString(1, identity);
ps.execute();
ps.close();
} catch (SQLException e) {
// Handle the exception
}
}
<!--[if !supportLineBreakNewLine]-->
once the transaction is complete, the application should reset the identity as follows:
public void clearIdentity(Connection conn) {
PreparedStatement ps;
try {
ps = conn.prepareCall("begin dbms_session.clear_identifier(); end;");
ps.execute();
ps.close();
} catch (SQLException e) {
// Handle the exception
}
}
<!--[if !supportLineBreakNewLine]-->
Please guide me for same.
Thanx in advance.
Bhadu<!--[endif]-->
View 6 Replies
View Related
Jun 30, 2006
I want to insert a new record into a table with an Identity field and return the new Identify field value back to the data stream (for later insertion as a foreign key in another table).
What is the most direct way to do this in SSIS?
TIA,
barkingdog
P.S. Or should I pass the identity value back in a variable and not make it part of the data stream?
View 12 Replies
View Related
Mar 3, 2006
1. Is it legal and OK to use a MSDN SQL copy on a production environment or is it strickly for test environments ??
2. If I own a legal copy of SQL 7 with 5 cals, can I legally use SQL MSDE and have more than 5 people access my SQL server or am I also limited to 5 users as my original ??
Sorry I am a newbie at this SQL thing.
View 1 Replies
View Related
Oct 9, 2013
I'm trying to move specific data from three linked tables on a source database to three tables on a destination database by generating dynamic SQL INSERT scripts but am getting stuck on the last set of INSERT statements. I don't think I can use SSIS because the source autonumber fields may already exist on the destination side but I could be wrong.
For simplicity, Table 1 (T1) has one autonumber key of PK1 as well as other fields (A1, B1, etc.).
Table 2 (T2) has one autonumber key of PK2 and a foreign key (FK1) that links back to PK1 as well as other fields (A2, B2, etc.).
Table 3 (T3) has one autonumber key of PK3 and a foreign key (FK2) that links back to PK2 as well as other fields (A3, B3, etc.).
Like this:
T1: PK1, A1, B1, etc.
T2: PK2, FK1, A2, B2, etc.
T3: PK3, FK2, A3, B3, etc.
So, I'm able to query the source database T1 to generate my dynamic SQL INSERT statements that will be run on the destination side. I'm also able to generate my dynamic SQL statements to insert into T2 but when I get to T3 I currently am stuck figuring out how to insert because the destination side is unable to match it's FK2 to the just inserted PK2. It throws the below error.
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
View 3 Replies
View Related
Jan 25, 2015
I have table of three column first column is an ID column. However at creation of the table i have not set this column to auto increment. Then i have copied 50 rows in another table to this table then set the ID column values to zero.
Now I have changed the ID column to auto increment seed=1 increment=1 but the problem is i couldn't figure out how to update this ID column with zero value set to each row with this auto increment values so the ID column would have values from 1-50. Is there a away to do this?
View 6 Replies
View Related
Sep 19, 2005
Ok,I just need to know how to get the last record inserted by the highestIDENTITY number. Even if the computer was rebooted and it was twoweeks ago. (Does not have to do with the session).Any help is appreciated.Thanks,Trint
View 2 Replies
View Related
Jun 19, 2008
Hi,
I am having problem in bulk update of a sql server table haning identity column from a datatable( has no identity column) using sqlbulkcopy. I tried several approaches, but it does not show any error nor is the table getting updated. But the identity value seems to getting increased every time.
thanks.
varun
View 6 Replies
View Related
Aug 1, 2014
I'm working with a third-party database (SQL Server 2005) and the problem here is the following:
- There are a bunch of ETL processes that needs to insert rows on a table (let's call this table T) and at the same time, an ERP (owner of T) is up and running (reading, updating and inserting on T).
- The PK of T is an Integer.
Today all ETL processes uses (select max(ID) + 1 from T) to insert new rows, so just picture the scenario. It is a mess! Everyday they get duplicate key error when 2 or more concurrent processes are trying to insert a row (with the max) at the same time.
Considering that I can't change the PK, what is the best approach to solve this problem?
To sum up:
* I need to have processes in parallel inserting on T
* I can't change anything on T
* The PK is NOT an Identity
View 4 Replies
View Related
Mar 2, 2008
Does anyone have a script that can drop the Identity columns from all the tables in a database? Thanks
View 1 Replies
View Related
Aug 12, 2009
when i alter non identity column to identity column using this Query alter table testid alter column test int identity(1,1) then i got this error message Msg 156, Level 15, State 1, Line 3 Incorrect syntax near the keyword 'identity'.
View 2 Replies
View Related