Showing posts with label checks. Show all posts
Showing posts with label checks. Show all posts

Wednesday, March 28, 2012

Precedence Constraint Expressions

Hi all

I've got a package that checks the length of chars in a flatfile and if it's correct it executes the dataflow task.

How can i write an expression in the precedense constraint editor to skip the dataflow task if there is an error in the script task?

Thank you

Set a variable in the script task and then test the variable in the precedence constraint.|||

Something similar to:

Code Snippet

If [File is Valid condition] Then

Dts.Variables.Item("User::ValidFile").Value = 1

Else

Dts.Variables.Item("User::ValidFile").Value = 0

End If

in the script task (mark the variable as ReadWrite in the script task properties) and

Code Snippet

@.ValidFile==1

in the precedence constraint. You can set the expression by double-clicking the precendence constraint and choosing Expression and Constraint in the Evaluation operation property.

|||

Thanks for all your help Phil and JWelch.

Friday, March 9, 2012

Possible to make a procedure "sleep" or run periodically?

Is it possible to put a "sleep" command in a stored procedure.
I would like to write a procedure that periodically checks some things in my
database, but I don't want them to suck up a lot of resources. If I could
write a procedure that runs in a loop with a 5 minute sleep command, that
would do it.
Or is this the wrong approach in SQL Server? I realize I could set up a
separate scheduled task that executes a procedure using ISQL. Is this a
better method?
Rick Harrison.I don't know enough about the particual need to know if there is a better
way or is this is a good way... I've done things like this in the past using
the WAITFOR command. You'll find info in BOL...
--
Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com
"Rick Harrrison" <rick@.knowware.com> wrote in message
news:uGKLBEQxDHA.1060@.TK2MSFTNGP12.phx.gbl...
> Is it possible to put a "sleep" command in a stored procedure.
> I would like to write a procedure that periodically checks some things in
my
> database, but I don't want them to suck up a lot of resources. If I could
> write a procedure that runs in a loop with a 5 minute sleep command, that
> would do it.
> Or is this the wrong approach in SQL Server? I realize I could set up a
> separate scheduled task that executes a procedure using ISQL. Is this a
> better method?
> Rick Harrison.
>|||Use SQL Server Agent to schedule the stored procedure?
--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Rick Harrrison" <rick@.knowware.com> wrote in message
news:uGKLBEQxDHA.1060@.TK2MSFTNGP12.phx.gbl...
> Is it possible to put a "sleep" command in a stored procedure.
> I would like to write a procedure that periodically checks some things in
my
> database, but I don't want them to suck up a lot of resources. If I could
> write a procedure that runs in a loop with a 5 minute sleep command, that
> would do it.
> Or is this the wrong approach in SQL Server? I realize I could set up a
> separate scheduled task that executes a procedure using ISQL. Is this a
> better method?
> Rick Harrison.
>|||Hi Rick,
Thank you for using MSDN Newsgroup! I think Aaron and Brian have point out ways to run the
stored procedure (SP) on a schedule basis.
Based on my experience, it's better to use scheduled job IF you want to run your SP in a 5
minutes loop (it does handle that gracefully). The WAITFOR statement is also a good method
to implement this, however, it can only work after a specified time interval has passed or a
specified time is reached, unless you use an explicit loop in your SP.
Additionally, the stored procedure will remain suspended until the WAITFOR completes, this
may affect the performance. However, it can easily be embedded in your script and is not
Agent related. So it depends on your scenario and the needs you want to meet.
Rick, does this answer your question? If there is anything more I can do to assist you, please
feel free to post it in the group.
Best regards,
Billy Yao
Microsoft Online Support
----
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only. Thanks.|||Thanks! WAITFOR is what I was looking for. I did searches using "sleep" and
"pause", but I didn't think of "wait" or "delay".
Rick.
"Brian Moran" <brian@.solidqualitylearning.com> wrote in message
news:Osu%23o1QxDHA.1680@.TK2MSFTNGP12.phx.gbl...
> I don't know enough about the particual need to know if there is a better
> way or is this is a good way... I've done things like this in the past
using
> the WAITFOR command. You'll find info in BOL...
> --
> Brian Moran
> Principal Mentor
> Solid Quality Learning
> SQL Server MVP
> http://www.solidqualitylearning.com
>
> "Rick Harrrison" <rick@.knowware.com> wrote in message
> news:uGKLBEQxDHA.1060@.TK2MSFTNGP12.phx.gbl...
> > Is it possible to put a "sleep" command in a stored procedure.
> >
> > I would like to write a procedure that periodically checks some things
in
> my
> > database, but I don't want them to suck up a lot of resources. If I
could
> > write a procedure that runs in a loop with a 5 minute sleep command,
that
> > would do it.
> >
> > Or is this the wrong approach in SQL Server? I realize I could set up a
> > separate scheduled task that executes a procedure using ISQL. Is this a
> > better method?
> >
> > Rick Harrison.
> >
> >
>|||Thanks! Somehow I had overlooked this feature. I knew it was possible to
schedule maintenance plans, which I do, but I didn't know you could run any
procedure on a schedule.
Rick.
"Aaron Bertrand - MVP" <aaron@.TRASHaspfaq.com> wrote in message
news:OEAHM7QxDHA.1088@.tk2msftngp13.phx.gbl...
> Use SQL Server Agent to schedule the stored procedure?
> --
> Aaron Bertrand
> SQL Server MVP
> http://www.aspfaq.com/
>
>
> "Rick Harrrison" <rick@.knowware.com> wrote in message
> news:uGKLBEQxDHA.1060@.TK2MSFTNGP12.phx.gbl...
> > Is it possible to put a "sleep" command in a stored procedure.
> >
> > I would like to write a procedure that periodically checks some things
in
> my
> > database, but I don't want them to suck up a lot of resources. If I
could
> > write a procedure that runs in a loop with a 5 minute sleep command,
that
> > would do it.
> >
> > Or is this the wrong approach in SQL Server? I realize I could set up a
> > separate scheduled task that executes a procedure using ISQL. Is this a
> > better method?
> >
> > Rick Harrison.
> >
> >
>|||Both techniques will be useful for me. Thank you.
""Billy Yao [MSFT]"" <v-binyao@.online.microsoft.com> wrote in message
news:FTG3OcWxDHA.424@.cpmsftngxa07.phx.gbl...
> Hi Rick,
> Thank you for using MSDN Newsgroup! I think Aaron and Brian have point out
ways to run the
> stored procedure (SP) on a schedule basis.
> Based on my experience, it's better to use scheduled job IF you want to
run your SP in a 5
> minutes loop (it does handle that gracefully). The WAITFOR statement is
also a good method
> to implement this, however, it can only work after a specified time
interval has passed or a
> specified time is reached, unless you use an explicit loop in your SP.
> Additionally, the stored procedure will remain suspended until the WAITFOR
completes, this
> may affect the performance. However, it can easily be embedded in your
script and is not
> Agent related. So it depends on your scenario and the needs you want to
meet.
> Rick, does this answer your question? If there is anything more I can do
to assist you, please
> feel free to post it in the group.
> Best regards,
> Billy Yao
> Microsoft Online Support
> ----
> Get Secure! - www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.
> Please reply to newsgroups only. Thanks.
>
>

Saturday, February 25, 2012

Possible Hack Attempt - Guidence Needed

Dear All,
I run a trace what checks for "Audit Login Fail". To be honest I set it up
out of Interest, never expecting anything to come of it. Yesterday I was on
holiday and got in today to find that I have had some audit failures.
They go something like this:-
Login failed for user 'sa'
Login failed for user 'admin'
Login failied for user 'probe'
Login failed for user 'sql'
Login failed for user 'Nessus-Test-User'
There are clusters of these which are done within a second.
Therefore I have reported an attempted hack. Can anyone tell me if I have
jumped the gun here, and if not what can I do to trace the hacker.
Thanks
PeterDid you also check to see if any security scanning tools
were run on the server? Something like MBSA?
Generally there is an entry in the Windows event log when
running security scanning tools.
You can use a network sniffer to track login attempts.
You can find more information on securing SQL Server at the
SQL Server security center site:
[url]http://www.microsoft.com/sql/techinfo/administration/2000/security/default.asp[/ur
l]
-Sue
On Tue, 12 Apr 2005 03:13:02 -0700, "Peter Nolan"
<PeterNolan@.discussions.microsoft.com> wrote:

>Dear All,
>I run a trace what checks for "Audit Login Fail". To be honest I set it up
>out of Interest, never expecting anything to come of it. Yesterday I was on
>holiday and got in today to find that I have had some audit failures.
>They go something like this:-
>Login failed for user 'sa'
>Login failed for user 'admin'
>Login failied for user 'probe'
>Login failed for user 'sql'
>Login failed for user 'Nessus-Test-User'
>There are clusters of these which are done within a second.
>Therefore I have reported an attempted hack. Can anyone tell me if I have
>jumped the gun here, and if not what can I do to trace the hacker.
>Thanks
>Peter|||Thanks for your input Sue.
Unfortunatly I do not have any server access, and the person I needed to
speak to (Head of IT Security) is on holiday.
I have done some research and found that it was indeed a hack attempt (have
a look at http://www.nessus.org) however they could not actually get into th
e
database as the sa password is too tight. Thank you for the link to SQL
Security I have been though that before and have already put in the
requirements.
The though is that our Parent Company sometimes do security audits and this
maybe one of those, but we will know more tomorrow.
Anyway thank you again for your response.
Peter
"Sue Hoegemeier" wrote:

> Did you also check to see if any security scanning tools
> were run on the server? Something like MBSA?
> Generally there is an entry in the Windows event log when
> running security scanning tools.
> You can use a network sniffer to track login attempts.
> You can find more information on securing SQL Server at the
> SQL Server security center site:
> [url]http://www.microsoft.com/sql/techinfo/administration/2000/security/default.asp[/
url]
> -Sue
> On Tue, 12 Apr 2005 03:13:02 -0700, "Peter Nolan"
> <PeterNolan@.discussions.microsoft.com> wrote:
>
>