How can I set DefaultValue in a SQL script?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to set a default value to a numeric field, using a SQL script(it has to be that way), but I always get a synthax error

alter table Table1 add Field1 float DefaultValue =

Has someone got a solution to this problem?
 
Servane said:
I am trying to set a default value to a numeric field, using a SQL script(it has to be that way), but I always get a synthax error:

alter table Table1 add Field1 float DefaultValue = 0

Has someone got a solution to this problem?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


The correct syntax would be:

ALTER TABLE <table> ADD <column> <data type> DEFAULT 0

I believe in Access XP you have to have ANSI-92 option set.


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

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

iQA/AwUBQGSTm4echKqOuFEgEQIj8gCfYymGroWScfBBYR5L6MA551HbEGsAoKNH
7LdoRgLNs2M8caf7v7LA5Nv7
=ZtCc
-----END PGP SIGNATURE-----
 
Thank you.
It gives me a synthax error though (I have tried on Access 97, 2000 and 2003 with the ansi-92 option like you said

Servane
 
thank you for your help
I found the answer
alter table <table> add <column><type> 0 <-we don't need the word DEFAULT, in fact
 
Back
Top