functions and sequences
- From: Jeff Kish <jeff.kish@xxxxxxx>
- Date: Wed, 04 May 2005 11:15:24 -0400
Hi.
I realize that ms sql doesn't really have sequences like Oracle and some other
db's.
I was wondering, given sql server 2000, and the restrictions placed upon
writing user defined functions, is it possible even to do this:
I'd like to write a function that I can call from the db layer to return a
sequence.
It would be defined by a table and column name, and in Oracle it would do a
nextval sort of call on a sequence defined for that table and column.
In ms sql it would increment a column I'm using for sequences and return the
value.
The usage would be in sql statements to supply the a value for an id column.
sort of:
insert into table(col1,col2) values ('x',myFunc.nextseq('table','col2'))
Basically, is there any way to get around the restrictions on writing UDF's in
MS Sql 2000 to do that? I'm trying to keep a certain level of sql generic.
Thanks for your patience
.
- Follow-Ups:
- Re: functions and sequences
- From: sienko
- Re: functions and sequences
- From: David Portas
- Re: functions and sequences
- Prev by Date: Re: How to if-then-else in T-SQL
- Next by Date: Re: functions and sequences
- Previous by thread: How to if-then-else in T-SQL
- Next by thread: Re: functions and sequences
- Index(es):
Relevant Pages
|