
9 Aug
2012
9 Aug
'12
2:21 a.m.
I have a string in the following format: ALTER TABLE QuestionnaireCategory ADD CONSTRAINT DF_QuestionaireCategory_QuestionaireCategoryID DEFAULT ("123") FOR QuestionnaireCategoryID That I need to convert to: ALTER TABLE QuestionnaireCategory ALTER QuestionnaireCategoryID SET DEFAULT ("123") The former being MSSQL format and the latter being postgresql. I have a sed script that does it and works great except for when the DEFAULT value itself contains braces, eg: DEFAULT (newid()) The problem is that my sed script says to start at the "(" and then read up until a ")", but I really mean to say read up until a matching ")". Can I do this with sed or should I be using something else? Thanks James