By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,943 Members | 1,890 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,943 IT Pros & Developers. It's quick & easy.

Quick SQL wording Question

P: n/a
Hi all,
Let me start this out by saying that I don't know much about sql
statements. I hae a microsoft access database which has a default
value for CustomerNumber. This default value is a 4 digit random
number. The way i have it set up currently is
((1000*Rnd())+1)+(Hour(Now()) & Minute(Now())). How (or does) would
this translate into sql? the reason i ask is because the upsize wizard
won't upsize this table because of this value.
Thanks for your help guys.

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Are you referring to MS SQL Server or JET 4.x? You'd have to change the
formula to use T-SQL instead of VBA functions: (just a guess)

((1000 * Rand(1)) + 1) + DatePart(hh, GETDATE()) + DatePart(n,
GETDATE())

Would using an IDENTITY data type be better, since it is unique?

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQT9o5IechKqOuFEgEQIExACaAs6+EG5j9hu96E9/DbahqyYtn3YAnidD
NAtqrv6C5wIyTJhNUMoEK4+d
=7Uay
-----END PGP SIGNATURE-----
Magno101 wrote:
Hi all,
Let me start this out by saying that I don't know much about sql
statements. I hae a microsoft access database which has a default
value for CustomerNumber. This default value is a 4 digit random
number. The way i have it set up currently is
((1000*Rnd())+1)+(Hour(Now()) & Minute(Now())). How (or does) would
this translate into sql? the reason i ask is because the upsize wizard
won't upsize this table because of this value.
Thanks for your help guys.


Nov 13 '05 #2

P: n/a
I am not sure whether SQL Server has a Random Number function comparable to
Rnd, but you have to use SQL Server terms when you redefine the tables from
Access (actually Jet database engine) to SQL Server.

Perhaps asking in a newsgroup about SQL Server would be better. Or, perhaps
looking in the SQL Server user manuals or at http://msdn.microsoft.com would
be worthwhile. I'm sure that, in your decision to upsize, you did consider
that the SQL was different and that Access functions are not available to
SQL Server -- that is what you are encountering.

Larry Linson
Microsoft Access MVP
"Magno101" <Ma******@Aol.com> wrote in message
news:ch********@odbk17.prod.google.com...
Hi all,
Let me start this out by saying that I don't know much about sql
statements. I hae a microsoft access database which has a default
value for CustomerNumber. This default value is a 4 digit random
number. The way i have it set up currently is
((1000*Rnd())+1)+(Hour(Now()) & Minute(Now())). How (or does) would
this translate into sql? the reason i ask is because the upsize wizard
won't upsize this table because of this value.
Thanks for your help guys.

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.