Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
This_guy_needs_help
Starting Member
1 Post |
Posted - 2013-08-31 : 11:36:49
|
Hi everyone,I know this has been probably been asked before but this has a little twist to it...I'm generating a random number to create an Order Number in C#, and I need to check if there is a duplicate Order Number in my sql table, but what I need to do ( I have figured this out before but lost my code ) that if it does find a duplicate number that I need it to return an output of 1 and if there is no duplicate order number I need it to return a 0 so I can handle it in my code.I have figured this out ages ago but I can't find my code anywhere for it and am stuck trying to figure it out again.Thanks everyone for helping me with this.Sincerely,This_guy_needs_help |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2013-08-31 : 15:21:16
|
SELECT COUNT(*)FROM (select number from dbo.table1intersectselect @parameter) AS d Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-09-02 : 09:04:19
|
why do you need to generate it at application layer? why not just make it identity in database so that its gets generated automatically?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|