Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

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

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..



Very Important crosS Applying yaK Herder

52326 Posts

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

SQL Server MVP

Go to Top of Page
  Previous Topic Topic Next 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.02 seconds. Powered By: Snitz Forums 2000