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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Fetch a variable value

Author  Topic 

kote_alex
Posting Yak Master

112 Posts

Posted - 2009-11-24 : 08:37:18
So I work with an E.R.P. program , as does almost everybody else on this forum , at some report the program generates a unique number like so... abs(tablexxx.columnxxx)='xxxx' and I have to fetch somehow that values, and it doesn't use any temp table or something like that it just has a stored select that runs when u want it and automatically generates that 4 digit value.
Can I somehow grab that value after it's declared ?
Thanks !

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-11-25 : 01:25:30
select abs(checksum(newid()))%10000

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

kote_alex
Posting Yak Master

112 Posts

Posted - 2009-11-25 : 02:28:19
sorry , but it doesn't generate the same number ...
I should tell you that all these values are stored in table but there's no way to distinguish them because it has no date or other kind of entry.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-11-25 : 02:51:34
Why do you want to generate the same number?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

kote_alex
Posting Yak Master

112 Posts

Posted - 2009-11-27 : 02:18:35
quote:
Originally posted by madhivanan

Why do you want to generate the same number?

Madhivanan

Failing to plan is Planning to fail



because that number identifies a unique number stored in a large table .
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-11-27 : 02:22:19
so you want to get the unique number and use it in lots of other places? or is the reqmnt to grab unique number thats generated in a table?
Go to Top of Page

kote_alex
Posting Yak Master

112 Posts

Posted - 2009-11-27 : 04:02:06
quote:
Originally posted by visakh16

so you want to get the unique number and use it in lots of other places? or is the reqmnt to grab unique number thats generated in a table?



exactly the second question...
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-11-27 : 22:20:26
are you using sql 2005?
Go to Top of Page
   

- Advertisement -