March 24, 2005 at 2:36 pm
Can someone show me an example of how to add a field to a table using a SQL statement using the SQL web admin?
I promise I'll only ask once, it will work for all fields/tables right?
March 24, 2005 at 2:57 pm
ALTER TABLE TableName ADD
NewColName /*datatype*/int /*null or not null, null is the default*/not null /*only if you need a default value*/ default(0)
GO
March 24, 2005 at 3:04 pm
Should these 2 lines work by themselves?
ALTER TABLE tblAccount ADD
[MailServer] varchar(50)
P.S. I forgoit i already had a post about this, I was going to delete this thread, but you had already replied.
March 24, 2005 at 9:43 pm
I don't see why they wouldn't,
but I'd go with this :
ALTER TABLE tblAccount ADD
[MailServer] varchar(50) null -- just to make it obvious that the column will accept nulls.
BTW MailServer doesn't need to be in brackets. If it does, it means it's a reserved keyword and another name should be used (for best practice).
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply