Showing posts with label dynamic SQL sql server. Show all posts
Showing posts with label dynamic SQL sql server. Show all posts

Monday, October 22, 2012

Warnings in SSIS

apparently fail a package in run time, as opposed to , for e.g. , management studio which just shows a warning

Friday, March 2, 2012

Adding extended properties with dynamic SQL

I had a table with non user friendly column names - I translated that to a view with decent column names
I wanted to easily add this to the extended properties
this is what I did:

DECLARE
@sql nvarchar(max) select
@name = N''Translation'',
@value = N'''
@level0type = N''SCHEMA'', @level0name = dbo,
@level1type = N''TABLE'', @level1name = TARGET,
@level2type = N''COLUMN'', @level2name ='
@sql = 'EXEC sys.sp_addextendedproperty + c.name + ''', + c2.name +';'from
(
select name ,column_idfrom sys.columns where
)
inner join (select name ,column_idfrom sys.columns where
)
on c2.column_id= c.column_id
object_id =(select object_id('TARGET')) c2
object_id =(select object_id('SOURCE')) c