main logo
Subject: Re: Converting an app to use remote views
Author: Bob Archer
Posted: 2001/03/06 17:19:23
 
View Entire Thread
New Search


<i><font color="#663300">
What is the best way to proceed? I could try to figure out how to write the NewID() code as a stored procedure on the SQL server. (If any of you have done this, an example would help)

Larry</font></i>

Here is an sp_NewID():

CREATE PROC sp_NewID

@basetablename varchar(30) = 'default'

AS

Declare @returnNewID int

BEGIN TRANSACTION NewID

SELECT @basetablename = LOWER( /at/ basetablename)

IF NOT EXISTS (SELECT *
FROM sy_uniqueid
WHERE sy_uniqueid .DO.T tablename = @basetablename)
BEGIN
INSERT INTO sy_uniqueid
VALUES (@basetablename
,0)

Update sy_uniqueid
SET last_id = last_id + 1
, /at/ returnNewID = last_id
WHERE sy_uniqueid .DO.T tablename = @basetablename

COMMIT TRANSACTION NewID

Return @returnNewID

*****************
BOb

 
©2001 Bob Archer
<-- Prior Message New Search Next Message -->