Showing posts with label defined. Show all posts
Showing posts with label defined. Show all posts

Monday, March 26, 2012

On Failure WorkFlow not getting Exectuted

i created a DTS package in SQL 2000 using the enterprise manager.

I have defined a SQL task to drop some temporary tables on failure of another SQL task. Also the same temporary tables need to be dropped on success of another task. the on success workflow is working fine. but when i add the on failure workflow to the temporary table dropping task, the temp table droppin is not getting excuted at all either for success nor for the failure. please help me out.

So multiple conditions are pointed to the same failure "workflow"?

If so, change the Multiple constraints option on one of the precedence constraints from the default of "Logical AND" (all constraints must evaluluate to true) to "Logical OR" (only one constraint must evaluate to true).|||Logical OR is great feature in SSIS, but I think the question is about DTS 2000, which did not have this option. In DTS 2000 you need to duplicate error-handling tasks. Or move to SSIS :)|||It worked when i duplicated the error-handling tasks..

Friday, March 23, 2012

On delete trigger for a view

Hi!
I have a view defined in MANAGE database as:
CREATE VIEW dbo.sysdatabasesview AS
SELECT *
FROM master.dbo.sysdatabases WITH (nolock)
GO
Trying to place a trigger on it:
CREATE TRIGGER sysdatabasesview$onDelete ON [dbo].[sysdatabasesview]
FOR DELETE
AS
Declare @.user_name sysname, @.msg varchar(3000)
select @.user_name = name
from deleted
set @.msg = 'Delete database ' + @.user_name + ' on server ' +
@.@.servername + ' from host ' + host_name()
insert into MANAGE..MAIL (recipient, subject, message, occur)
values ('myemail@.domain.local', 'Delete datadase', @.msg, getdate())
Get an error:
Error 208: Invalid object name 'dbo.sysdatabasesview'
What is wrong?
Thanks.This is a multi-part message in MIME format.
--=_NextPart_000_0012_01C3872D.EA0155E0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
You cannot create a FOR trigger (now known as an AFTER trigger) on a =view. You can create an INSTEAD OF trigger on a view, however.
-- Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Roust_m" <roustam@.hotbox.ru> wrote in message =news:a388fd78.0309300241.4462ca59@.posting.google.com...
Hi!
I have a view defined in MANAGE database as:
CREATE VIEW dbo.sysdatabasesview AS
SELECT *
FROM master.dbo.sysdatabases WITH (nolock)
GO
Trying to place a trigger on it:
CREATE TRIGGER sysdatabasesview$onDelete ON [dbo].[sysdatabasesview] FOR DELETE AS Declare @.user_name sysname, @.msg varchar(3000) select @.user_name =3D name from deleted
set @.msg =3D 'Delete database ' + @.user_name + ' on server ' +
@.@.servername + ' from host ' + host_name()
insert into MANAGE..MAIL (recipient, subject, message, occur) values ('myemail@.domain.local', 'Delete datadase', @.msg, getdate())
Get an error:
Error 208: Invalid object name 'dbo.sysdatabasesview'
What is wrong?
Thanks.
--=_NextPart_000_0012_01C3872D.EA0155E0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&

You cannot create a FOR trigger (now =known as an AFTER trigger) on a view. You can create an INSTEAD OF trigger on =a view, however.
-- Tom
---T=homas A. Moreau, BSc, PhD, MCSE, MCDBASQL Server MVPColumnist, SQL =Server ProfessionalToronto, ON Canadahttp://www.pinnaclepublishing.com/sql">www.pinnaclepublishing.com=/sql
"Roust_m" wrote in message news:a388fd=78.0309300241.4462ca59@.posting.google.com...Hi!I have a view defined in MANAGE database as:CREATE VIEW dbo.sysdatabasesview ASSELECT *FROM master.dbo.sysdatabases WITH (nolock)GOTrying to place a =trigger on it:CREATE TRIGGER sysdatabasesview$onDelete ON [dbo].[sysdatabasesview] FOR DELETE AS Declare @.user_name =sysname, @.msg varchar(3000) select @.user_name =3D name from deleted =set @.msg =3D 'Delete database ' + @.user_name + ' on server ' =+@.@.servername + ' from host ' + host_name()insert into MANAGE..MAIL (recipient, =subject, message, occur) values ('myemail@.domain.local', ='Delete datadase', @.msg, getdate()) Get an error:Error =208: Invalid object name 'dbo.sysdatabasesview'What is wrong?Thanks.

--=_NextPart_000_0012_01C3872D.EA0155E0--sql

Friday, March 9, 2012

OLE DB Source parameters ignored when subquery?

I am using an OLE DB Source with SQL command for the data access mode. I defined parameters, then added a complex query with subqueries. It seems like the parameters for a query are not being filled correctly (because I am getting too many rows returned). At one point I saw an error message the said something to the effect that the parameters would be ignored when there was a subquery in the SQL.

Can anyone shed some light on this?

Thanks,

Laurence

I don't know if that is true or not but regardless of that you should stop using parameters as explained here: http://blogs.conchango.com/jamiethomson/archive/2005/12/09/2480.aspx

-Jamie

|||

Jamie,

I have read your blog many times and it is really helpful. Thanks.

In this instance, the query is long and complex, and I might as well go to a script task as a string variable.

I am disappointed that parameters do not seem to be working correctly, thereby making my life more difficult.

Laurence

|||

Yeah, script task is a good option in those circumstances.

N.B. SP1 will have an expression builder attached to variables which will make it easier to build your expressions.

-Jamie

|||Would you mind sharing the long, complex query that didnt work for you?

OLE DB Source - Data Access Mode - SQL Command

I got a package with data flow task. Within the data flow task I have flat file with Fiscal Calendar defined. I got another data source within the data flow task, which is OLE DB Source. I want to use SQL Command as data access mode. SQL similar to one the below is in there.

-

DECLARE @.startdate DATETIME
DECLARE @.enddate DATETIME
DECLARE @.date DATETIME
DECLARE @.id INT

SET @.startdate = '1993-09-26' --Change these to
SET @.enddate = '2010-09-25' --whatever you want
SET @.id = 1
SET @.date = DATEADD(dd, @.id, @.startdate)

WHILE @.date <= @.enddate
BEGIN
select @.date CalendarDate,
DATEPART(dd, @.date) CalendarDayMonth,
DATEPART(dy, @.date) CalendarDayYear,
DATEPART(dw, @.date) CalendarDayWeek,
DATENAME(dw, @.date) CalendarDayName

SET @.id = @.id + 1
SET @.date = DATEADD(dd, @.id, @.startdate)

END

-

This SQL works fine in SSMS and returns around 6000 rows. But when I plug the same SQL in OLE DB Source it returns only the first record. It is not going through the WHILE loop.

Has anyone came across this?

Thanks

Sutha

Hey,

OLEDB Source connection to what database?

Brian

|||

I am connecting to my warehouse DB but the source is just the SQL, it doesn't need to extract anything from DB, as the SQL should give the result set.

What I should ideally use is "Execute SQL Task", which is in Control Flow Task.

Maybe I could achieve this by putting into a temp table and source it from the temp table. I am going to check it out.

Thanks

Sutha

Saturday, February 25, 2012

OLE DB Command transform and Output columns.

Hi All,

I have an OLE DB transform with a SQL Command of:

sp_get_sponsor_parent ?,? OUTPUT

where sp_get_sponsor_parent is defined like:

CREATE PROCEDURE [dbo].[sp_get_sponsor_parent]

@.pEID int,

@.results int OUTPUT

AS

BEGIN

.

.

.

END

I map the columns, refresh & OK out of the component without trouble, but on executing the package it fails during validation on this component. I'm utterly stumped.

Any light shed would be greatly appreciated.

Many thanks in advance,

Tamim.

I don't see any 'EXEC' in your sql commnad...may this be the problem?|||

This wasn't the problem Rafael - the EXEC is optional.

I resolved the issue however, by trialing just this one thing - outputting to a (derived) column within OLE DB Command - in a new/clean package. To that end I would like to bring the following example to everyone's attention: it's concise, comprehensive and clear, and thus can be considered canonical. No doubt there are other such examples out there, but this particular one helped me to push forwards, and thus deserves the publicity:

http://wiki.sqlis.com/default.aspx/SQLISWiki/OLEDBCommandTransformationAndIdentityColumns.html?diff=y

Thanks very much for your input Rafael.

Cheers,

Tamim.

Monday, February 20, 2012

Old Backups not being deleted

We are having a consistent problem here with the archived backups not being
deleted like is defined in the maintenance plans.
We have the maintenance plan set to backup all user databases and keep the
past 7 days worth. But after the 7th day it is NOT deleting the older
backups. So the first time we found this out was when the server ran out of
disk space and we found a full months worth of backups in the SQL Server
backup directory!
Any idea why this is happen and how to fix it so that maint plan works as
its being told to work?
Thanks,
John Gundrum
There are some knowledge base articles regarding this issue. Have you checked
those? One of them refers to the transaction log backup being part of the
plan but one of the databases being backed up having SIMPLE as the recovery
method.
"John Gundrum" wrote:

> We are having a consistent problem here with the archived backups not being
> deleted like is defined in the maintenance plans.
> We have the maintenance plan set to backup all user databases and keep the
> past 7 days worth. But after the 7th day it is NOT deleting the older
> backups. So the first time we found this out was when the server ran out of
> disk space and we found a full months worth of backups in the SQL Server
> backup directory!
> Any idea why this is happen and how to fix it so that maint plan works as
> its being told to work?
> Thanks,
> John Gundrum
|||Yes, we've looked into that and the transaction log is not part of the plan.
The back plan has been recreated once again for the user databases and we'll
start to see if old backups are being deleted later this week.
John Gundrum
"Charles Allen" wrote:
[vbcol=seagreen]
> There are some knowledge base articles regarding this issue. Have you checked
> those? One of them refers to the transaction log backup being part of the
> plan but one of the databases being backed up having SIMPLE as the recovery
> method.
> "John Gundrum" wrote:

Old Backups not being deleted

We are having a consistent problem here with the archived backups not being
deleted like is defined in the maintenance plans.
We have the maintenance plan set to backup all user databases and keep the
past 7 days worth. But after the 7th day it is NOT deleting the older
backups. So the first time we found this out was when the server ran out of
disk space and we found a full months worth of backups in the SQL Server
backup directory!
Any idea why this is happen and how to fix it so that maint plan works as
its being told to work?
Thanks,
John Gundrum
> Any idea why this is happen and how to fix it so that maint plan works as
> its being told to work?
I had maintenance plans set up to delete backups more than two days old, and
it was leaving 4 or 5 days, depending on if it was over the weekend or not.
I've heard many reports of maintenance plans having similarly weird
behavior.
Instead of trying to investigate and fix the nonsense, I wrote a standalone
app that deleted backups older than 2 days.
|||Take a look at:
BUG: Expired Transaction Log Backups May Not Be Deleted by Maintenance Plan
http://support.microsoft.com/default...&Product=sql2k
"I saw it work in a cartoon once so I am pretty sure I can do it."
"Aaron [SQL Server MVP]" wrote:

> I had maintenance plans set up to delete backups more than two days old, and
> it was leaving 4 or 5 days, depending on if it was over the weekend or not.
> I've heard many reports of maintenance plans having similarly weird
> behavior.
> Instead of trying to investigate and fix the nonsense, I wrote a standalone
> app that deleted backups older than 2 days.
>
>

Old Backups not being deleted

We are having a consistent problem here with the archived backups not being
deleted like is defined in the maintenance plans.
We have the maintenance plan set to backup all user databases and keep the
past 7 days worth. But after the 7th day it is NOT deleting the older
backups. So the first time we found this out was when the server ran out of
disk space and we found a full months worth of backups in the SQL Server
backup directory!
Any idea why this is happen and how to fix it so that maint plan works as
its being told to work?
Thanks,
John Gundrum> Any idea why this is happen and how to fix it so that maint plan works as
> its being told to work?
I had maintenance plans set up to delete backups more than two days old, and
it was leaving 4 or 5 days, depending on if it was over the weekend or not.
I've heard many reports of maintenance plans having similarly weird
behavior.
Instead of trying to investigate and fix the nonsense, I wrote a standalone
app that deleted backups older than 2 days.|||Take a look at:
BUG: Expired Transaction Log Backups May Not Be Deleted by Maintenance Plan
http://support.microsoft.com/default.aspx?scid=kb;en-us;303292&Product=sql2k
--
"I saw it work in a cartoon once so I am pretty sure I can do it."
"Aaron [SQL Server MVP]" wrote:
> > Any idea why this is happen and how to fix it so that maint plan works as
> > its being told to work?
> I had maintenance plans set up to delete backups more than two days old, and
> it was leaving 4 or 5 days, depending on if it was over the weekend or not.
> I've heard many reports of maintenance plans having similarly weird
> behavior.
> Instead of trying to investigate and fix the nonsense, I wrote a standalone
> app that deleted backups older than 2 days.
>
>

Old Backups not being deleted

We are having a consistent problem here with the archived backups not being
deleted like is defined in the maintenance plans.
We have the maintenance plan set to backup all user databases and keep the
past 7 days worth. But after the 7th day it is NOT deleting the older
backups. So the first time we found this out was when the server ran out of
disk space and we found a full months worth of backups in the SQL Server
backup directory!
Any idea why this is happen and how to fix it so that maint plan works as
its being told to work?
Thanks,
John Gundrum> Any idea why this is happen and how to fix it so that maint plan works as
> its being told to work?
I had maintenance plans set up to delete backups more than two days old, and
it was leaving 4 or 5 days, depending on if it was over the weekend or not.
I've heard many reports of maintenance plans having similarly weird
behavior.
Instead of trying to investigate and fix the nonsense, I wrote a standalone
app that deleted backups older than 2 days.|||Take a look at:
BUG: Expired Transaction Log Backups May Not Be Deleted by Maintenance Plan
http://support.microsoft.com/defaul...2&Product=sql2k
"I saw it work in a cartoon once so I am pretty sure I can do it."
"Aaron [SQL Server MVP]" wrote:

> I had maintenance plans set up to delete backups more than two days old, a
nd
> it was leaving 4 or 5 days, depending on if it was over the weekend or not
.
> I've heard many reports of maintenance plans having similarly weird
> behavior.
> Instead of trying to investigate and fix the nonsense, I wrote a standalon
e
> app that deleted backups older than 2 days.
>
>