Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Auto generation key field

By Vinoth Kumar,

In Our Stored procedure three input and one output

table name complaint and key field complaint_ID

Input
Now year,
Now date,
Now month,

Output
Key field(call number)

 

Auto generation key fields

First two letter current year, companies with current month first three letters and current date also
Last position our key fields
Numeric value starting from 0001 next record increment 1 numeric value for 0002
Example;
Input
2009
02
January
Output

09Jan020001
09Jan020002
09Jan020003
...............
................
................
09Jan02N

Next day
Start from
09Jan030001
09Jan030002
09Jan030003
...............
................
................
09Jan03N

Next month
09Feb020001
09Feb020002
09Feb020003
...............
................
................
09Feb02N

 


Total article views: 1008 | Views in the last 30 days: 6
 
Related Articles
ARTICLE

Stairway to SQL PowerShell Level 3: Input and Output with PowerShell

This level will cover some of the Input/Output operations you can use with PowerShell.

FORUM

Merge Inputs Several Rows but no Output

Merge has Input but no Output

FORUM

What shape would you use to concatenate two input fields into a single output field?

What shape would you use to concatenate two input fields into a single output field?

SCRIPT

Month Name

Function to return the Month Name for month number input

FORUM

how to display previous month data along with current month data

I am using stored procedure to display current month data using query. Now i want to display previou...

Tags
t-sql    
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones