Showing posts with label custom. Show all posts
Showing posts with label custom. Show all posts

Thursday, March 22, 2012

Detecting Custom Objects Used by SQL Server 2000 objects

Hello,
I work as a software engineer and we have installed third party and custom
in-house dlls and ocx on our SQL Server 2000 server to support our business
applications. These dlls and ocx are referenced by the database
objects(jobs, storedprocedures). What I need to do is to generate a list of
all the dlls and ocx that our SQL Server reference, so that I can copy these
files out to our new future SQL Server box.
Does anyone here know how to do this? Is there a system table in one of the
system databases that keep track of the information I'm seeking?
Thanks you.
Scott Yu
"Scott Yu" <ScottYu@.discussions.microsoft.com> wrote in message
news:C95F6558-D80C-44F7-8E2D-65ED12C13721@.microsoft.com...
> Hello,
> I work as a software engineer and we have installed third party and custom
> in-house dlls and ocx on our SQL Server 2000 server to support our
> business
> applications. These dlls and ocx are referenced by the database
> objects(jobs, storedprocedures). What I need to do is to generate a list
> of
> all the dlls and ocx that our SQL Server reference, so that I can copy
> these
> files out to our new future SQL Server box.
> Does anyone here know how to do this? Is there a system table in one of
> the
> system databases that keep track of the information I'm seeking?
>
Unfortunately, you will have to dig through the text of the stored
procedures for calls to sp_oacreate.
set textsize 64000
exec sp_msforeachdb '
select text from syscomments
where text like ''%sp_oacreate%'''
This will give you the progid's of the com components used by sql server.
They must be copied to the new server and registered there, along with all
of their dependencies.
This is an exceedingly difficult thing for a DBA to get right. You may need
to track down the owners of each component to sucessfully move it to the new
server.
David
|||Hey David,
Thanks for the script. I pretty much did the same thing by scripting out
the storedprocedures and jobs, but that was before I learned of
sp_msforeachdb, thanks to you. The hardest part is trying to locate all the
dependent dlls. Another dll hell.
Thank you David.
Scott Yu
"David Browne" wrote:

> "Scott Yu" <ScottYu@.discussions.microsoft.com> wrote in message
> news:C95F6558-D80C-44F7-8E2D-65ED12C13721@.microsoft.com...
> Unfortunately, you will have to dig through the text of the stored
> procedures for calls to sp_oacreate.
> set textsize 64000
> exec sp_msforeachdb '
> select text from syscomments
> where text like ''%sp_oacreate%'''
> This will give you the progid's of the com components used by sql server.
> They must be copied to the new server and registered there, along with all
> of their dependencies.
> This is an exceedingly difficult thing for a DBA to get right. You may need
> to track down the owners of each component to sucessfully move it to the new
> server.
> David
>
>
|||One more thing to remember when you are searching using the LIKE operation:
"_" is a wildcard character meaning "any single character." When you want
the literal "_", you'll want to use brackets like so:
SELECT [name]
FROM syscomments
WHERE [text] LIKE '%sp[_]oacreate%"
Sincerely,
Anthony Thomas
"Scott Yu" wrote:
[vbcol=seagreen]
> Hey David,
> Thanks for the script. I pretty much did the same thing by scripting out
> the storedprocedures and jobs, but that was before I learned of
> sp_msforeachdb, thanks to you. The hardest part is trying to locate all the
> dependent dlls. Another dll hell.
> Thank you David.
> Scott Yu
> "David Browne" wrote:
|||Thank you very much Anthony. What is the difference between "%" and "_" in
TL SQL?
Scott
"AnthonyThomas" wrote:
[vbcol=seagreen]
> One more thing to remember when you are searching using the LIKE operation:
> "_" is a wildcard character meaning "any single character." When you want
> the literal "_", you'll want to use brackets like so:
> SELECT [name]
> FROM syscomments
> WHERE [text] LIKE '%sp[_]oacreate%"
> Sincerely,
>
> Anthony Thomas
>
> "Scott Yu" wrote:
|||Never mind. After re-reading your reply, I understoodd the difference
between "%" and "_".
Thank you.
"AnthonyThomas" wrote:
[vbcol=seagreen]
> One more thing to remember when you are searching using the LIKE operation:
> "_" is a wildcard character meaning "any single character." When you want
> the literal "_", you'll want to use brackets like so:
> SELECT [name]
> FROM syscomments
> WHERE [text] LIKE '%sp[_]oacreate%"
> Sincerely,
>
> Anthony Thomas
>
> "Scott Yu" wrote:
sql

Wednesday, March 21, 2012

Detecting Custom Objects Used by SQL Server 2000 objects

Hello,
I work as a software engineer and we have installed third party and custom
in-house dlls and ocx on our SQL Server 2000 server to support our business
applications. These dlls and ocx are referenced by the database
objects(jobs, storedprocedures). What I need to do is to generate a list of
all the dlls and ocx that our SQL Server reference, so that I can copy these
files out to our new future SQL Server box.
Does anyone here know how to do this? Is there a system table in one of the
system databases that keep track of the information I'm seeking?
Thanks you.
Scott Yu"Scott Yu" <ScottYu@.discussions.microsoft.com> wrote in message
news:C95F6558-D80C-44F7-8E2D-65ED12C13721@.microsoft.com...
> Hello,
> I work as a software engineer and we have installed third party and custom
> in-house dlls and ocx on our SQL Server 2000 server to support our
> business
> applications. These dlls and ocx are referenced by the database
> objects(jobs, storedprocedures). What I need to do is to generate a list
> of
> all the dlls and ocx that our SQL Server reference, so that I can copy
> these
> files out to our new future SQL Server box.
> Does anyone here know how to do this? Is there a system table in one of
> the
> system databases that keep track of the information I'm seeking?
>
Unfortunately, you will have to dig through the text of the stored
procedures for calls to sp_oacreate.
set textsize 64000
exec sp_msforeachdb '
select text from syscomments
where text like ''%sp_oacreate%'''
This will give you the progid's of the com components used by sql server.
They must be copied to the new server and registered there, along with all
of their dependencies.
This is an exceedingly difficult thing for a DBA to get right. You may need
to track down the owners of each component to sucessfully move it to the new
server.
David|||Hey David,
Thanks for the script. I pretty much did the same thing by scripting out
the storedprocedures and jobs, but that was before I learned of
sp_msforeachdb, thanks to you. The hardest part is trying to locate all th
e
dependent dlls. Another dll hell.
Thank you David.
Scott Yu
"David Browne" wrote:

> "Scott Yu" <ScottYu@.discussions.microsoft.com> wrote in message
> news:C95F6558-D80C-44F7-8E2D-65ED12C13721@.microsoft.com...
> Unfortunately, you will have to dig through the text of the stored
> procedures for calls to sp_oacreate.
> set textsize 64000
> exec sp_msforeachdb '
> select text from syscomments
> where text like ''%sp_oacreate%'''
> This will give you the progid's of the com components used by sql server.
> They must be copied to the new server and registered there, along with all
> of their dependencies.
> This is an exceedingly difficult thing for a DBA to get right. You may ne
ed
> to track down the owners of each component to sucessfully move it to the n
ew
> server.
> David
>
>|||One more thing to remember when you are searching using the LIKE operation:
"_" is a wildcard character meaning "any single character." When you want
the literal "_", you'll want to use brackets like so:
SELECT [name]
FROM syscomments
WHERE [text] LIKE '%sp[_]oacreate%"
Sincerely,
Anthony Thomas
"Scott Yu" wrote:
[vbcol=seagreen]
> Hey David,
> Thanks for the script. I pretty much did the same thing by scripting out
> the storedprocedures and jobs, but that was before I learned of
> sp_msforeachdb, thanks to you. The hardest part is trying to locate all
the
> dependent dlls. Another dll hell.
> Thank you David.
> Scott Yu
> "David Browne" wrote:
>|||Thank you very much Anthony. What is the difference between "%" and "_" in
TL SQL?
Scott
"AnthonyThomas" wrote:
[vbcol=seagreen]
> One more thing to remember when you are searching using the LIKE operation
:
> "_" is a wildcard character meaning "any single character." When you want
> the literal "_", you'll want to use brackets like so:
> SELECT [name]
> FROM syscomments
> WHERE [text] LIKE '%sp[_]oacreate%"
> Sincerely,
>
> Anthony Thomas
>
> "Scott Yu" wrote:
>|||Never mind. After re-reading your reply, I understoodd the difference
between "%" and "_".
Thank you.
"AnthonyThomas" wrote:
[vbcol=seagreen]
> One more thing to remember when you are searching using the LIKE operation
:
> "_" is a wildcard character meaning "any single character." When you want
> the literal "_", you'll want to use brackets like so:
> SELECT [name]
> FROM syscomments
> WHERE [text] LIKE '%sp[_]oacreate%"
> Sincerely,
>
> Anthony Thomas
>
> "Scott Yu" wrote:
>

Detecting Custom Objects Used by SQL Server 2000 objects

Hello,
I work as a software engineer and we have installed third party and custom
in-house dlls and ocx on our SQL Server 2000 server to support our business
applications. These dlls and ocx are referenced by the database
objects(jobs, storedprocedures). What I need to do is to generate a list of
all the dlls and ocx that our SQL Server reference, so that I can copy these
files out to our new future SQL Server box.
Does anyone here know how to do this? Is there a system table in one of the
system databases that keep track of the information I'm seeking?
Thanks you.
Scott Yu"Scott Yu" <ScottYu@.discussions.microsoft.com> wrote in message
news:C95F6558-D80C-44F7-8E2D-65ED12C13721@.microsoft.com...
> Hello,
> I work as a software engineer and we have installed third party and custom
> in-house dlls and ocx on our SQL Server 2000 server to support our
> business
> applications. These dlls and ocx are referenced by the database
> objects(jobs, storedprocedures). What I need to do is to generate a list
> of
> all the dlls and ocx that our SQL Server reference, so that I can copy
> these
> files out to our new future SQL Server box.
> Does anyone here know how to do this? Is there a system table in one of
> the
> system databases that keep track of the information I'm seeking?
>
Unfortunately, you will have to dig through the text of the stored
procedures for calls to sp_oacreate.
set textsize 64000
exec sp_msforeachdb '
select text from syscomments
where text like ''%sp_oacreate%'''
This will give you the progid's of the com components used by sql server.
They must be copied to the new server and registered there, along with all
of their dependencies.
This is an exceedingly difficult thing for a DBA to get right. You may need
to track down the owners of each component to sucessfully move it to the new
server.
David|||Hey David,
Thanks for the script. I pretty much did the same thing by scripting out
the storedprocedures and jobs, but that was before I learned of
sp_msforeachdb, thanks to you. The hardest part is trying to locate all the
dependent dlls. Another dll hell.
Thank you David.
Scott Yu
"David Browne" wrote:
> "Scott Yu" <ScottYu@.discussions.microsoft.com> wrote in message
> news:C95F6558-D80C-44F7-8E2D-65ED12C13721@.microsoft.com...
> > Hello,
> >
> > I work as a software engineer and we have installed third party and custom
> > in-house dlls and ocx on our SQL Server 2000 server to support our
> > business
> > applications. These dlls and ocx are referenced by the database
> > objects(jobs, storedprocedures). What I need to do is to generate a list
> > of
> > all the dlls and ocx that our SQL Server reference, so that I can copy
> > these
> > files out to our new future SQL Server box.
> >
> > Does anyone here know how to do this? Is there a system table in one of
> > the
> > system databases that keep track of the information I'm seeking?
> >
> Unfortunately, you will have to dig through the text of the stored
> procedures for calls to sp_oacreate.
> set textsize 64000
> exec sp_msforeachdb '
> select text from syscomments
> where text like ''%sp_oacreate%'''
> This will give you the progid's of the com components used by sql server.
> They must be copied to the new server and registered there, along with all
> of their dependencies.
> This is an exceedingly difficult thing for a DBA to get right. You may need
> to track down the owners of each component to sucessfully move it to the new
> server.
> David
>
>|||One more thing to remember when you are searching using the LIKE operation:
"_" is a wildcard character meaning "any single character." When you want
the literal "_", you'll want to use brackets like so:
SELECT [name]
FROM syscomments
WHERE [text] LIKE '%sp[_]oacreate%"
Sincerely,
Anthony Thomas
"Scott Yu" wrote:
> Hey David,
> Thanks for the script. I pretty much did the same thing by scripting out
> the storedprocedures and jobs, but that was before I learned of
> sp_msforeachdb, thanks to you. The hardest part is trying to locate all the
> dependent dlls. Another dll hell.
> Thank you David.
> Scott Yu
> "David Browne" wrote:
> >
> > "Scott Yu" <ScottYu@.discussions.microsoft.com> wrote in message
> > news:C95F6558-D80C-44F7-8E2D-65ED12C13721@.microsoft.com...
> > > Hello,
> > >
> > > I work as a software engineer and we have installed third party and custom
> > > in-house dlls and ocx on our SQL Server 2000 server to support our
> > > business
> > > applications. These dlls and ocx are referenced by the database
> > > objects(jobs, storedprocedures). What I need to do is to generate a list
> > > of
> > > all the dlls and ocx that our SQL Server reference, so that I can copy
> > > these
> > > files out to our new future SQL Server box.
> > >
> > > Does anyone here know how to do this? Is there a system table in one of
> > > the
> > > system databases that keep track of the information I'm seeking?
> > >
> >
> > Unfortunately, you will have to dig through the text of the stored
> > procedures for calls to sp_oacreate.
> >
> > set textsize 64000
> > exec sp_msforeachdb '
> > select text from syscomments
> > where text like ''%sp_oacreate%'''
> >
> > This will give you the progid's of the com components used by sql server.
> > They must be copied to the new server and registered there, along with all
> > of their dependencies.
> >
> > This is an exceedingly difficult thing for a DBA to get right. You may need
> > to track down the owners of each component to sucessfully move it to the new
> > server.
> >
> > David
> >
> >
> >|||Thank you very much Anthony. What is the difference between "%" and "_" in
TL SQL?
Scott
"AnthonyThomas" wrote:
> One more thing to remember when you are searching using the LIKE operation:
> "_" is a wildcard character meaning "any single character." When you want
> the literal "_", you'll want to use brackets like so:
> SELECT [name]
> FROM syscomments
> WHERE [text] LIKE '%sp[_]oacreate%"
> Sincerely,
>
> Anthony Thomas
>
> "Scott Yu" wrote:
> > Hey David,
> >
> > Thanks for the script. I pretty much did the same thing by scripting out
> > the storedprocedures and jobs, but that was before I learned of
> > sp_msforeachdb, thanks to you. The hardest part is trying to locate all the
> > dependent dlls. Another dll hell.
> >
> > Thank you David.
> >
> > Scott Yu
> >
> > "David Browne" wrote:
> >
> > >
> > > "Scott Yu" <ScottYu@.discussions.microsoft.com> wrote in message
> > > news:C95F6558-D80C-44F7-8E2D-65ED12C13721@.microsoft.com...
> > > > Hello,
> > > >
> > > > I work as a software engineer and we have installed third party and custom
> > > > in-house dlls and ocx on our SQL Server 2000 server to support our
> > > > business
> > > > applications. These dlls and ocx are referenced by the database
> > > > objects(jobs, storedprocedures). What I need to do is to generate a list
> > > > of
> > > > all the dlls and ocx that our SQL Server reference, so that I can copy
> > > > these
> > > > files out to our new future SQL Server box.
> > > >
> > > > Does anyone here know how to do this? Is there a system table in one of
> > > > the
> > > > system databases that keep track of the information I'm seeking?
> > > >
> > >
> > > Unfortunately, you will have to dig through the text of the stored
> > > procedures for calls to sp_oacreate.
> > >
> > > set textsize 64000
> > > exec sp_msforeachdb '
> > > select text from syscomments
> > > where text like ''%sp_oacreate%'''
> > >
> > > This will give you the progid's of the com components used by sql server.
> > > They must be copied to the new server and registered there, along with all
> > > of their dependencies.
> > >
> > > This is an exceedingly difficult thing for a DBA to get right. You may need
> > > to track down the owners of each component to sucessfully move it to the new
> > > server.
> > >
> > > David
> > >
> > >
> > >|||Never mind. After re-reading your reply, I understoodd the difference
between "%" and "_".
Thank you.
"AnthonyThomas" wrote:
> One more thing to remember when you are searching using the LIKE operation:
> "_" is a wildcard character meaning "any single character." When you want
> the literal "_", you'll want to use brackets like so:
> SELECT [name]
> FROM syscomments
> WHERE [text] LIKE '%sp[_]oacreate%"
> Sincerely,
>
> Anthony Thomas
>
> "Scott Yu" wrote:
> > Hey David,
> >
> > Thanks for the script. I pretty much did the same thing by scripting out
> > the storedprocedures and jobs, but that was before I learned of
> > sp_msforeachdb, thanks to you. The hardest part is trying to locate all the
> > dependent dlls. Another dll hell.
> >
> > Thank you David.
> >
> > Scott Yu
> >
> > "David Browne" wrote:
> >
> > >
> > > "Scott Yu" <ScottYu@.discussions.microsoft.com> wrote in message
> > > news:C95F6558-D80C-44F7-8E2D-65ED12C13721@.microsoft.com...
> > > > Hello,
> > > >
> > > > I work as a software engineer and we have installed third party and custom
> > > > in-house dlls and ocx on our SQL Server 2000 server to support our
> > > > business
> > > > applications. These dlls and ocx are referenced by the database
> > > > objects(jobs, storedprocedures). What I need to do is to generate a list
> > > > of
> > > > all the dlls and ocx that our SQL Server reference, so that I can copy
> > > > these
> > > > files out to our new future SQL Server box.
> > > >
> > > > Does anyone here know how to do this? Is there a system table in one of
> > > > the
> > > > system databases that keep track of the information I'm seeking?
> > > >
> > >
> > > Unfortunately, you will have to dig through the text of the stored
> > > procedures for calls to sp_oacreate.
> > >
> > > set textsize 64000
> > > exec sp_msforeachdb '
> > > select text from syscomments
> > > where text like ''%sp_oacreate%'''
> > >
> > > This will give you the progid's of the com components used by sql server.
> > > They must be copied to the new server and registered there, along with all
> > > of their dependencies.
> > >
> > > This is an exceedingly difficult thing for a DBA to get right. You may need
> > > to track down the owners of each component to sucessfully move it to the new
> > > server.
> > >
> > > David
> > >
> > >
> > >

Detect whether runtime or executiontime in custom component

In my custom component in the validate() method I want to determine whether this method is called during runtime or during designtime. I Can't find a property for this on PipelineComponent or ComponentMetaData. Is it possible?

Regards,
HenkI don't think you can, and I also don't think it should matter. Why would you want this?|||Well, during validation I want to access a package level variable that is filled with a lookup table by a preceding task. However, at designtime, there is no such thing as a task that has executed previously, so the variable does not exist then.
|||Should the variable not exist, but the value may be rubbish? You cannot create variables at run-time (... I'm pretty sure you can't, no run-time structure changes allowed in SSIS). If something is really missing I think you are perhaps digging too deep into the validation, unless it is only certain settings that induce this issue.

The way to get round this would be to set DelayValidation to true, so validation only happens at runtime.

You would do this for a Exec SQL Task that requires a table for created by a preceeding task, such that the table will not exist until part through run-time. Normally it is good to validate the SQL, but in this case it will cause a problem, so we can bypass validation.|||

DarrenSQLIS wrote:

You cannot create variables at run-time

I'm afraid I didn't make myself clear. I do not create variables at runtime.

But is my observation correct that if you define a variable (at designtime of course!) at package level, that variable is not seen by custom components in a dataflow task in that packge until executiontime\runtime? (so it doesn't even contain rubbish, but it just isn't there)

(By the way I can easily get around the fact that I can't detect designtime or executiontime, so that's no issue anymore)|||

Henk v J. wrote:

that variable is not seen by custom components in a dataflow task in that packge until executiontime\runtime


You sure? I have a component that uses variables, actually the variable name is a property value, and I validate that the variable selected does exist. This works at design-time calls to Validate.

Henk v J. wrote:

By the way I can easily get around the fact that I can't detect designtime or executiontime, so that's no issue anymore)


Don't be shy. I'm intrigued now, what have you done?

|||No rocket-science, I just look whether the variable exists and if it doesn't I do nothing Big Smile

By the way you are probably right about, because I can't see the variable at runtime either, so there is something else wrong... I post a separate issue on that.
Thanks for your reactions!|||Ok, I lied I don't use variables in Validate, but I do in AcquireConnections, so still in a component, and that is called during design and execution times.



if (VariableDispenser.Contains(location))
{
IDTSVariables90 vars = null;
VariableDispenser.LockOneForRead(location, ref vars);
return vars[0].Value.ToString();
}

|||Try me.Designmode property may be it will work for you.

Detect whether runtime or designtime in custom component

In my custom component in the validate() method I want to determine whether this method is called during runtime or during designtime. I Can't find a property for this on PipelineComponent or ComponentMetaData. Is it possible?

Regards,
HenkI don't think you can, and I also don't think it should matter. Why would you want this?|||Well, during validation I want to access a package level variable that is filled with a lookup table by a preceding task. However, at designtime, there is no such thing as a task that has executed previously, so the variable does not exist then.
|||Should the variable not exist, but the value may be rubbish? You cannot create variables at run-time (... I'm pretty sure you can't, no run-time structure changes allowed in SSIS). If something is really missing I think you are perhaps digging too deep into the validation, unless it is only certain settings that induce this issue.

The way to get round this would be to set DelayValidation to true, so validation only happens at runtime.

You would do this for a Exec SQL Task that requires a table for created by a preceeding task, such that the table will not exist until part through run-time. Normally it is good to validate the SQL, but in this case it will cause a problem, so we can bypass validation.|||

DarrenSQLIS wrote:

You cannot create variables at run-time

I'm afraid I didn't make myself clear. I do not create variables at runtime.

But is my observation correct that if you define a variable (at designtime of course!) at package level, that variable is not seen by custom components in a dataflow task in that packge until executiontime\runtime? (so it doesn't even contain rubbish, but it just isn't there)

(By the way I can easily get around the fact that I can't detect designtime or executiontime, so that's no issue anymore)|||

Henk v J. wrote:

that variable is not seen by custom components in a dataflow task in that packge until executiontime\runtime


You sure? I have a component that uses variables, actually the variable name is a property value, and I validate that the variable selected does exist. This works at design-time calls to Validate.

Henk v J. wrote:

By the way I can easily get around the fact that I can't detect designtime or executiontime, so that's no issue anymore)


Don't be shy. I'm intrigued now, what have you done?

|||No rocket-science, I just look whether the variable exists and if it doesn't I do nothing Big Smile

By the way you are probably right about, because I can't see the variable at runtime either, so there is something else wrong... I post a separate issue on that.
Thanks for your reactions!|||Ok, I lied I don't use variables in Validate, but I do in AcquireConnections, so still in a component, and that is called during design and execution times.



if (VariableDispenser.Contains(location))
{
IDTSVariables90 vars = null;
VariableDispenser.LockOneForRead(location, ref vars);
return vars[0].Value.ToString();
}

|||Try me.Designmode property may be it will work for you.

Detect whether executiontime or designtime in custom component

In my custom component in the validate() method I want to determine whether this method is called during runtime or during designtime. I Can't find a property for this on PipelineComponent or ComponentMetaData. Is it possible?

Regards,
HenkI don't think you can, and I also don't think it should matter. Why would you want this?

|||Well, during validation I want to access a package level variable that is filled with a lookup table by a preceding task. However, at designtime, there is no such thing as a task that has executed previously, so the variable does not exist then.|||Should the variable not exist, but the value may be rubbish? You cannot create variables at run-time (... I'm pretty sure you can't, no run-time structure changes allowed in SSIS). If something is really missing I think you are perhaps digging too deep into the validation, unless it is only certain settings that induce this issue.

The way to get round this would be to set DelayValidation to true, so validation only happens at runtime.

You would do this for a Exec SQL Task that requires a table for created by a preceeding task, such that the table will not exist until part through run-time. Normally it is good to validate the SQL, but in this case it will cause a problem, so we can bypass validation.|||

DarrenSQLIS wrote:

You cannot create variables at run-time

I'm afraid I didn't make myself clear. I do not create variables at runtime.

But is my observation correct that if you define a variable (at designtime of course!) at package level, that variable is not seen by custom components in a dataflow task in that packge until executiontime\runtime? (so it doesn't even contain rubbish, but it just isn't there)

(By the way I can easily get around the fact that I can't detect designtime or executiontime, so that's no issue anymore)|||

Henk v J. wrote:

that variable is not seen by custom components in a dataflow task in that packge until executiontime\runtime


You sure? I have a component that uses variables, actually the variable name is a property value, and I validate that the variable selected does exist. This works at design-time calls to Validate.

Henk v J. wrote:

By the way I can easily get around the fact that I can't detect designtime or executiontime, so that's no issue anymore)


Don't be shy. I'm intrigued now, what have you done?

|||No rocket-science, I just look whether the variable exists and if it doesn't I do nothing Big Smile

By the way you are probably right about, because I can't see the variable at runtime either, so there is something else wrong... I post a separate issue on that.
Thanks for your reactions!|||Ok, I lied I don't use variables in Validate, but I do in AcquireConnections, so still in a component, and that is called during design and execution times.



if (VariableDispenser.Contains(location))
{
IDTSVariables90 vars = null;
VariableDispenser.LockOneForRead(location, ref vars);
return vars[0].Value.ToString();
}

|||Try me.Designmode property may be it will work for you.

Detect whether executiontime or designtime in custom component

In my custom component in the validate() method I want to determine whether this method is called during runtime or during designtime. I Can't find a property for this on PipelineComponent or ComponentMetaData. Is it possible?

Regards,
HenkI don't think you can, and I also don't think it should matter. Why would you want this?|||Well, during validation I want to access a package level variable that is filled with a lookup table by a preceding task. However, at designtime, there is no such thing as a task that has executed previously, so the variable does not exist then.
|||Should the variable not exist, but the value may be rubbish? You cannot create variables at run-time (... I'm pretty sure you can't, no run-time structure changes allowed in SSIS). If something is really missing I think you are perhaps digging too deep into the validation, unless it is only certain settings that induce this issue.

The way to get round this would be to set DelayValidation to true, so validation only happens at runtime.

You would do this for a Exec SQL Task that requires a table for created by a preceeding task, such that the table will not exist until part through run-time. Normally it is good to validate the SQL, but in this case it will cause a problem, so we can bypass validation.|||

DarrenSQLIS wrote:

You cannot create variables at run-time

I'm afraid I didn't make myself clear. I do not create variables at runtime.

But is my observation correct that if you define a variable (at designtime of course!) at package level, that variable is not seen by custom components in a dataflow task in that packge until executiontime\runtime? (so it doesn't even contain rubbish, but it just isn't there)

(By the way I can easily get around the fact that I can't detect designtime or executiontime, so that's no issue anymore)|||

Henk v J. wrote:

that variable is not seen by custom components in a dataflow task in that packge until executiontime\runtime


You sure? I have a component that uses variables, actually the variable name is a property value, and I validate that the variable selected does exist. This works at design-time calls to Validate.

Henk v J. wrote:

By the way I can easily get around the fact that I can't detect designtime or executiontime, so that's no issue anymore)


Don't be shy. I'm intrigued now, what have you done?

|||No rocket-science, I just look whether the variable exists and if it doesn't I do nothing Big Smile

By the way you are probably right about, because I can't see the variable at runtime either, so there is something else wrong... I post a separate issue on that.
Thanks for your reactions!|||Ok, I lied I don't use variables in Validate, but I do in AcquireConnections, so still in a component, and that is called during design and execution times.



if (VariableDispenser.Contains(location))
{
IDTSVariables90 vars = null;
VariableDispenser.LockOneForRead(location, ref vars);
return vars[0].Value.ToString();
}

|||Try me.Designmode property may be it will work for you.

Friday, February 24, 2012

Design question: static data & custom data & merging the two

OVERVIEW:
We have "normal" application data, like Company, and we have custom/override data that can override the "normal" data. We need the ability to switch back and forth between normal data and custom data and also merge the two (with custom data overriding any normal data fields).

BASIC QUESTION:
Is it best to set a flag in each table saying whether the row is custom or override OR
is it best to have a Normal table and a Custom/Override table?

MORE DETAIL IF NEEDED..........
Company Data
CompanyName - CompanyCity - Company Address
(Normal/Default Data) Microsoft - Seattle - 1 Microsoft Way
(Custom/Override Data) Microsoft - Atlanta - 1 Peachtree Way

So, the first row would show up in the application, unless the second row existed and at that point, the second row would be merged with the first row. Also would need the ability to switch back to the Normal row if the Custom row is deleted. Hope this makes sense.This seems like an unusual requirement, however, there a options available to implement it. Could you elaborate what 'merge' really does in this case? Aldo, do you have an idea of how common the 'custom' data is going to be? Is it a small percentage of rows in the table? Is it predictable at all? Is there only one 'custom' version of a particular row or you can have multiple 'custom' rows per every 'normal' row?|||"what 'merge' really does in this case"

We have a lot of applications running on customer's PC's (around 40,000), and each of the applications has the same base set of data, for example they all start out with a listing of Products. However, a couple thousand of the apps has the ability to go in and modify some of the data (custom data) for particular users. So the merge would override the base data with any custom data that has been created.

how common?

Well, it's only going to be available on a small set of applications, but it will be maybe 10% of data will be custom.

Is it predictable?
Yes, in the sense that we do know which fields are overridable/custom.

There is only on custom version of a particular row.

Hope this makes sense, let me know if I need to clarify.|||

craig11 wrote:

BASIC QUESTION:

Is it best to set a flag in each table saying whether the row is custom or override OR

is it best to have a Normal table and a Custom/Override table?

With respect to querying such data:

If none of the 'mergeable' columns are nullable than it would either be self-left-joins if the 'custom' rows are in the same table, or left-joins if you have separate tables for the 'custom' data. Plus you would also need to coalesce the columns from the 'normal' rows and the 'custom' rows using the corresponding function. So, the separate tables or the same table - it would basically be the same T-SQL and the bottom line is that cost-wise It would not be that much different assuming that you also make sure that use have useful indices in both cases. Using your example:

SELECT
COALESCE (Custom.[Company Name], Normal.[Company Name] as [Company Name],
COALESCE (Custom.[Company City], Normal.[Company City] as [Company City],
COALESCE (Custom.[Company Address], Normal.[Company Address]) as [Company Address]
FROM [Company Data] Normal LEFT JOIN [Company Data] Custom ON
Normal.[Company Id] = Custom.[Company Id]
AND Normal.[Flag] = 'Normal' AND Custom.[Flag] = 'Custom'

Or

SELECT
COALESCE (Custom.[Company Name], Normal.[Company Name] as [Company Name],
COALESCE (Custom.[Company City], Normal.[Company City] as [Company City],
COALESCE (Custom.[Company Address], Normal.[Company Address]) as [Company Address]
FROM [Company Data - Normal] Normal LEFT JOIN [Company Data - Custom] Custom ON
Normal.[Company Id] = Custom.[Company Id]

If some of the columns are nullable, then the things become a tiny bit more complicated, but still cost-wise it would not really have any effect.

With respect to updating such data:

If the ‘normal’ data for you deployed application is read-only most of the time then, you are likely better off using a separate table for the normal data residing on a dedicated read-only filegroup. Assuming that you would need to periodically deliver the changes in ‘normal’ data to the deployed applications, it could also be easily done by switching the filegroup to read-write mode for the duration of the sync procedures.

If the read-mostly model is not adequate, then, again there won‘t be much f a difference, except you will probably need a little more space for the flag column if you go with the same table approach.

You could also somewhat combine the two by partitioning your table and use two separate partitions instead of the two tables.

However, depending on actual data distributions and the update and concurrency patters, the variations in the index fragmentation could introduce additional considerations.

Sunday, February 19, 2012

Design Question

We have a third-party application that I want to extend. It used MS SQL as
a backend and I want to add new custom tables to the db. Is it bad practice
to add custom tables to the live db? Or should I create a seperate db to
hold these tables and synch the tables?
ThanksDo not add tables to the 3:rd party database. They won't like it. Also, you
never know what a future
upgrade program might do. Use your own database.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Jake" <Jake@.noemail.com> wrote in message news:%23CAiYGNpFHA.3940@.TK2MSFTNGP14.phx.gbl...[
color=darkred]
> We have a third-party application that I want to extend. It used MS SQL a
s a backend and I want
> to add new custom tables to the db. Is it bad practice to add custom tabl
es to the live db? Or
> should I create a seperate db to hold these tables and synch the tables?
> Thanks
>[/color]