Click here to Skip to main content
15,887,416 members
Home / Discussions / Database
   

Database

 
GeneralRe: Data Access Layer Pin
tonyalex26-Feb-07 0:58
tonyalex26-Feb-07 0:58 
GeneralRe: Data Access Layer Pin
Colin Angus Mackay26-Feb-07 5:08
Colin Angus Mackay26-Feb-07 5:08 
GeneralRe: Data Access Layer Pin
tonyalex2-Mar-07 2:49
tonyalex2-Mar-07 2:49 
GeneralRe: Data Access Layer Pin
Colin Angus Mackay2-Mar-07 6:35
Colin Angus Mackay2-Mar-07 6:35 
Questionrecords with their row numbers in a table Pin
indian14325-Feb-07 4:25
indian14325-Feb-07 4:25 
AnswerRe: records with their row numbers in a table Pin
Colin Angus Mackay25-Feb-07 4:37
Colin Angus Mackay25-Feb-07 4:37 
GeneralRe: records with their row numbers in a table Pin
indian14325-Feb-07 18:35
indian14325-Feb-07 18:35 
GeneralRe: records with their row numbers in a table Pin
xfitr226-Feb-07 8:28
xfitr226-Feb-07 8:28 
I do not recommend this but you could create a insert/delete trigger that loops through the recordset and inserts the new value. This is a performance hit. A sample trigger is below. You must have a primary key on the table to do this. I am confused of why you need to reference the rownumber. It has no significance. If you dont mind a few holes here and there after you have deleted a record, use an Identity column.

<br />
CREATE TRIGGER dbo.trg_Count <br />
   ON  dbo._TEST<br />
   AFTER INSERT, DELETE<br />
AS <br />
BEGIN<br />
	<br />
	SET NOCOUNT ON;<br />
	DECLARE @PKEY UNIQUEIDENTIFIER<br />
	DECLARE @I BIGINT<br />
	<br />
	IF ((SELECT trigger_nestlevel()) = 1)<br />
	BEGIN<br />
		DECLARE TRG_TEST_CUR CURSOR FOR<br />
		SELECT [GUID] FROM _TEST<br />
<br />
		OPEN TRG_TEST_CUR<br />
		FETCH NEXT FROM TRG_TEST_CUR<br />
		INTO @PKEY<br />
		<br />
		SET @I = 1<br />
<br />
		WHILE @@FETCH_STATUS = 0<br />
		BEGIN<br />
			UPDATE _TEST SET ID = @I WHERE [GUID] = @PKEY<br />
			SET @I = @I + 1<br />
			FETCH NEXT FROM TRG_TEST_CUR<br />
			INTO @PKEY<br />
		END<br />
		CLOSE TRG_TEST_CUR<br />
		DEALLOCATE TRG_TEST_CUR<br />
	END<br />
END<br />
GO<br />

QuestionHow To Do The Recursive Table Within My Appliaction? Pin
jasyGerges25-Feb-07 2:05
jasyGerges25-Feb-07 2:05 
AnswerRe: How To Do The Recursive Table Within My Appliaction? Pin
JUNEYT25-Feb-07 12:02
JUNEYT25-Feb-07 12:02 
QuestionReporting Services - online page count vs printed count Pin
pnslcs25-Feb-07 2:01
pnslcs25-Feb-07 2:01 
QuestionError when connection to the Server... vb.net 2005 ? [modified] Pin
kindman_nb24-Feb-07 22:52
kindman_nb24-Feb-07 22:52 
AnswerRe: Error when connection to the Server... vb.net 2005 ? Pin
WoutL1-Mar-07 2:43
WoutL1-Mar-07 2:43 
Questionsql connectivity Pin
vishal dhir24-Feb-07 21:07
vishal dhir24-Feb-07 21:07 
AnswerRe: sql connectivity Pin
Hesham Amin26-Feb-07 0:48
Hesham Amin26-Feb-07 0:48 
QuestionTo avoid aborting of transaction, on failure of trigger in Oracle Pin
Mushtaque Nizamani24-Feb-07 19:16
Mushtaque Nizamani24-Feb-07 19:16 
AnswerRe: To avoid aborting of transaction, on failure of trigger in Oracle Pin
andyharman25-Feb-07 23:41
professionalandyharman25-Feb-07 23:41 
QuestionGetting AutoNumber from last inserted row (C++)? Pin
MasterShin24-Feb-07 7:33
MasterShin24-Feb-07 7:33 
AnswerRe: Getting AutoNumber from last inserted row (C++)? Pin
Hesham Amin24-Feb-07 7:46
Hesham Amin24-Feb-07 7:46 
GeneralRe: Getting AutoNumber from last inserted row (C++)? Pin
MasterShin24-Feb-07 7:52
MasterShin24-Feb-07 7:52 
GeneralRe: Getting AutoNumber from last inserted row (C++)? Pin
Hesham Amin25-Feb-07 7:01
Hesham Amin25-Feb-07 7:01 
Questionarray parameter Pin
illusionFinder23-Feb-07 22:22
illusionFinder23-Feb-07 22:22 
AnswerRe: array parameter Pin
Harini N K24-Feb-07 1:02
Harini N K24-Feb-07 1:02 
QuestionQuery to Display records from 20 to 30 from total of 100 records Pin
indian14323-Feb-07 18:05
indian14323-Feb-07 18:05 
AnswerRe: Query to Display records from 20 to 30 from total of 100 records Pin
Hesham Amin24-Feb-07 7:29
Hesham Amin24-Feb-07 7:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.