473,401 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

how can i use NextVal() method in sqlserver?

Hi

How can i use Sql server Nextval()? I need to implement sequence numbers.

Thanks
vasavivenu
Mar 4 '11 #1
5 17010
debasisdas
8,127 Expert 4TB
Have you tried using

max (field_value) +1
Mar 4 '11 #2
ck9663
2,878 Expert 2GB
If your implementing sequence, try checking IDENTITY property of a numeric data type. There are a lot of considerations like simultaneous inserts, etc...

Good Luck!!!

~~ CK
Mar 4 '11 #3
Thank you, but when I am using this "max (field_value) +1" the starting number is Null,
If i take minimum of one number after only it works.But I need the sequence number is generate from starting point.

Thanks & Regards
Vasavivenu
Mar 7 '11 #4
ck9663
2,878 Expert 2GB
Use max (ISNULL(field_value,0)) + 1

Good Luck!!!

~~ CK
Mar 7 '11 #5
Its working.

Thanks & Regards

vasavivenu
Mar 9 '11 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ivo Anon | last post by:
I'm new to postgresql and I'm having problems with the 'nextval' function (or whatever it is called in postgresql). I created a table (called ADDRESS) using 'pgadmin' which has a serial field...
4
by: Paul Reddin | last post by:
Hi, Having just tested our database on V8.2 we get the following apparent incompatibility. A Trigger conatains the following line CREATE TRIGGER JABS.AU_CHNG_ENQUIRYITM AFTER UPDATE OF ..
7
by: pfa | last post by:
I have a udf which returns a table. I was hoping to access the NEXTVAL from a sequence to affect the logic flow and consequently the return result. I'm using a LANGUAGE C type function. Here's...
4
by: UDBDBA | last post by:
Hi: we have column with GENERATED ALWAYS AS DEFAULT. So, we can insert into this column manually and also let db2 generate a value for this column. Given a scenario, how can i find the NEXTVAL...
1
by: filip1150 | last post by:
I'm trying to find if there is any performance diference between explicitly using a sequence in the insert statement to generate values for a column and doing this in an insert trigger. I...
7
by: Rahul B | last post by:
Hi, If i do a "Select nextval for <seq_namefrom sysibm.sysdummy1", it increases the values of nextval by1. How can i find out the nextval of a sequence without actually increasing the value....
8
by: arachno | last post by:
My Oracle sequences seem to be auto-incrementing themselves "over time". My row ID's are sequenced like this: 1, 4, 5, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 41, etc I'm using...
2
by: sshade25 | last post by:
<html> <body> <?php $PGHOST = localhost; $PGDATABASE = "SantaRosaDB"; $PGUSER = "postgres"; $PGPASSWORD = "Casabubu25"; $PGPORT = 5432; $db_handle = pg_connect("dbname=$PGDATABASE...
0
by: vasavivenu | last post by:
Hi, How can i use sequence method in sql server? i have to change Mysql code to Sql server, SELECT nextval('Country_Mst_Seq') NextVal I need to change the above code into sql server....
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.