Unanswered: Constructing the 'create view stmt' from syscomments
I execute the following query to fetch the create view statement of a particular view:
select text from syscomments, sysobjects where name='myviewname' and syscomments.id=sysobjects.id;
I get multiple rows in the result.
In one case, I found that the statement was split after a word and the next row didn't include a space. In this case, I will have to append a ' ' (space) between row1 and row2 to construct the correct query.
Eg. row1: 'create view ..... table1'
row2: 'JOIN ....'
In another case, I found that the last word in row1 was split and continued in row2. In this case appending a space would give me an incorrect query.
Eg. row1: 'create view ..... tab'
row2: 'le1 JOIN ....'