Vote count:
0
this is an easy question, but I can't find out the solution...
I have to check if a column exists and add it if the test is negative. How can I do with only sql code?
This is the syntax for SQL Server:
IF NOT EXISTS (
SELECT *
FROM sys.columns
WHERE object_id = OBJECT_ID(N'[dbo].[Person]')
AND name = 'ColumnName'
)
BEGIN
--STUFF HERE
END
and for MS Access, using only SQL code... what is the right syntax to do it?
UPDATE: also a way to do a try cath statement would be ok, I only need to not add anything if it doesn't exist... so, also a try catch is ok, I think. Also try catch is easily possible to use in sql server... and for access?
asked 2 mins ago
MS Access: adding column if not exist (or try/catch it)
Aucun commentaire:
Enregistrer un commentaire