SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Generate DCN Nums
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

srinivasdasari
Starting Member

1 Posts

Posted - 09/18/2010 :  01:58:16  Show Profile  Reply with Quote
Hi All,

Im not much of gud in sql.My question is how to generate data based on today date from 1 - 100 based on two conditions.
I mean My Sample Query Is
-- select 'EDI' + CONVERT(nvarchar(20),getdate(),112) + 'A00001' AS DCN_NO
Output is: EDI20100918A00001
same like up to EDI20100918A00100
condition 1:
if their is no data in my table.
condition 2:
if their is some data based on today date like EDI20100918A001 to EDI20100918A00100
take the max column from table and generate the data from that column.I mean EDI20100918A00101 - EDI20100918A00200


How to generate Through Query..Plz help me..

Regards
vasu


cnuvas

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 09/18/2010 :  09:03:04  Show Profile  Reply with Quote
see

http://www.sqlteam.com/article/custom-auto-generated-sequences-with-sql-server

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000