|
 |
asp_databases thread: adding a column to a SQL table using ASP
Message #1 by Simon Newton <simonn@h...> on Thu, 1 Mar 2001 07:44:41 +1000
|
|
could someone give me a clue as how to script ASP to add a column to a
table in SQL7 + give it a name and set its properties.
cheers
Simon
Message #2 by "Peter Lanoie" <planoie@e...> on Wed, 28 Feb 2001 17:09:49 -0500
|
|
Your SQL statement should look like this...
ALTER TABLE tablename ADD fieldname datatype [ NOT NULL || NULL]
Use standard SQL datatypes. Use NULL or NOT NULL to Allow Nulls or not.
If you want to add more than one, just separate with a comma.
ALTER TABLE tablename ADD field1 INT, field2 CHAR(50)
Build your SQL into a string and then do a normal ASP SQL command execution.
You don't need to use a set on a recordset, just the connection execute
method.
objConn.Execute("ALTER TABLE tablename ADD field INT")
Look at Transact-SQL help for more details.
-----Original Message-----
From: Simon Newton [mailto:simonn@h...]
Sent: Wednesday, February 28, 2001 4:45 PM
To: ASP Databases
Subject: [asp_databases] adding a column to a SQL table using ASP
could someone give me a clue as how to script ASP to add a column to a
table in SQL7 + give it a name and set its properties.
cheers
Simon
Message #3 by "Wally Burfine" <oopconsultant@h...> on Wed, 28 Feb 2001 22:43:48 -0000
|
|
Run the "Alter Table" against the ADO connection.
Regards,
Wally
>From: Simon Newton <simonn@h...>
>Reply-To: "ASP Databases" <asp_databases@p...>
>To: "ASP Databases" <asp_databases@p...>
>Subject: [asp_databases] adding a column to a SQL table using ASP
>Date: Thu, 1 Mar 2001 07:44:41 +1000
>
>could someone give me a clue as how to script ASP to add a column to a
>table in SQL7 + give it a name and set its properties.
>
>cheers
>
>Simon
>
>
>
|
|
 |