Viewing 15 posts - 451 through 465 (of 641 total)
OK, to be consistent with the theoretical basis behind RDBMSs I could try, but feeling competent at a cursos based solution, rocks my world.:hehe:
June 9, 2011 at 3:22 pm
cte.three, please give me the main points about using ctes rather than cursors.
June 9, 2011 at 2:18 pm
Yes, I see how that would work. I am sticking with my cursor based script because it is strictly an administrative task, but I appreciate knowing about this other...
June 9, 2011 at 10:09 am
But this worked:
select t.name, c.name, d.name, d.definition
from sys.tables t
join
sys.default_constraints d
on d.parent_object_id = t.object_id
...
June 9, 2011 at 12:04 am
I like the way opc.three's cte uses a select statement to create a drop command, which can then be executed. Very cool. So that is the new way...
June 8, 2011 at 11:28 pm
OK, just going by the select statement in Lowell's response, i don't think it answers the questoin. I am trying to drop only one of the constraints, even if there...
June 8, 2011 at 11:09 pm
Oh your goodness, you're helping me again! I am all over this and will let you know how it goes. :w00t:
June 8, 2011 at 6:18 pm
Oh the concatenation symbols. Thanks so much Ninja. I appreciate the amazing support on this forum!
May 31, 2011 at 11:02 am
Jenny, Can you take another look?
This
sp_rename 'csmr.nameoftable.Active', 'IsActive', 'COLUMN';
Needs to become this:
DECLARE @sql0 nvarchar(4000)
SET @sql0 = 'sp_rename '+ ''@Table_Name'.Active'''', '''IsActive''', '''COLUMN''
EXEC(@sql0)
and I still can't get the quotes right. ...
May 31, 2011 at 10:37 am
I think this will be the last of it.
i am automating the renaming of the table column segment with the following Dynamic SQL, and am getting error:
"Msg 102, Level...
May 30, 2011 at 10:24 pm
you are right, thanks for support.
right now I have recreated the db and ran the above code and all it all looks good. I think I am fine.
Again thank...
May 30, 2011 at 5:57 pm
well, it appears to have worked for some columns but not for all. Some columns are missing a default constraint.
Do I need to add error handling? ...
May 30, 2011 at 12:44 pm
well, this, and it appears to have worked.
DECLARE @sql1 nvarchar(4000)
SET @sql1 = 'ALTER TABLE '+ @Table_Name + ' DROP ' + @default
EXEC(@sql1)
DECLARE @sql2 nvarchar(4000)
SET @sql2 = 'ALTER TABLE '...
May 30, 2011 at 12:41 pm
I have to accomplish 2 more things once the constraints are dropped.
2. change the datatype for all 22 tables
3. readd a default constraint for all 22 tables.
IE, I do not...
May 30, 2011 at 12:08 pm
Yees, that's it.
Am I still dealing with Dynamic SQL when I need to add conditional logic so that
1. after the default constraint is dropped, a second ALTER...
May 30, 2011 at 11:35 am
Viewing 15 posts - 451 through 465 (of 641 total)