Showing posts with label drop. Show all posts
Showing posts with label drop. Show all posts

Wednesday, March 7, 2012

Block to drop any object with ddl triger

Hi all,
I want block attempt to drop any objects(tables, sp, views...) of my data
base.
Have way to do this?
I did see same thing about DDL trigers, any one can sed-me one sample?
Thanks to allHi all,
Thanks,
I find one sample...
CREATE TRIGGER safety
ON DATABASE
FOR DROP_TABLE, ALTER_TABLE
AS
PRINT 'You must disable Trigger "safety" to drop or alter tables!'
ROLLBACK ;
Thanks again
"retf" <re.tf@.terra.com.br> escreveu na mensagem
news:%23cQ9yq6eGHA.1272@.TK2MSFTNGP03.phx.gbl...
> Hi all,
> I want block attempt to drop any objects(tables, sp, views...) of my data
> base.
> Have way to do this?
> I did see same thing about DDL trigers, any one can sed-me one sample?
> Thanks to all
>|||This should really be
CREATE TRIGGER safety
ON DATABASE
FOR DROP_TABLE, ALTER_TABLE
AS
BEGIN
RAISERROR('You must disable Trigger "safety" to drop or alter
tables!',16,1)
ROLLBACK ;
END
Without an error, a client may think the statement suceeded.
David
"retf" <re.tf@.terra.com.br> wrote in message
news:%23P2uRt6eGHA.3484@.TK2MSFTNGP02.phx.gbl...
> Hi all,
> Thanks,
> I find one sample...
> CREATE TRIGGER safety
> ON DATABASE
> FOR DROP_TABLE, ALTER_TABLE
> AS
> PRINT 'You must disable Trigger "safety" to drop or alter tables!'
> ROLLBACK ;
>
> Thanks again
> "retf" <re.tf@.terra.com.br> escreveu na mensagem
> news:%23cQ9yq6eGHA.1272@.TK2MSFTNGP03.phx.gbl...
>|||David Browne (davidbaxterbrowne no potted meat@.hotmail.com) writes:
> This should really be
>
> CREATE TRIGGER safety
> ON DATABASE
> FOR DROP_TABLE, ALTER_TABLE
> AS
> BEGIN
> RAISERROR('You must disable Trigger "safety" to drop or alter
> tables!',16,1)
> ROLLBACK ;
> END
> Without an error, a client may think the statement suceeded.
Quibble: there will be an error message without the RAISERROR. To
wit, in SQL 2005 a ROLLBACK in a trigger raises an error message.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Sunday, February 19, 2012

Blank parameters

Hi,

In my report, a parameter has list of values in a drop down list (3 static values - Yes, No, Both). If user selects "Both" the results should contain all values with status Yes and No. My stored proc acheives this as -

ColumnName = @.Parameter + '%' in where clause.

I created Non-Queried list of values with Both as "" (empty string). When I run the report, the report is not getting any values. The matrix is empty where as the dataset and stored procedure are picking values for the same. ("" , empty string in the status parameter)

Is there any way the RS considers the empty values ? How do I achieve this ?

Regards,

Chiro

Ok,

Let me make it clear. The stored proc has a default parameter "Status" for which if you neither give "YES" nor give "NO" it gets results for all YES and NO status. This is acheived as

1. I defined stored procedure as - CREATE PROCEDURE ProcName @.Status = '%' varchar(10), @.Param2 varchar(10).......

2. In where clause - ColumnName = @.Status + '%'

Now if you just execute query without any parameters, it gets all values for status YES as well as NO. This is working fine.

I want to display all these results in a report. I created a list of values parameter with values YES, NO, BOTH for status. I allowed Null and Blank for the parameter.

I am binding the data to a matrix. When I run the report without giving any value to status, it is not displaying results in the matrix at all. Ideally it should display all values with status YES and NO.

Can any one tell me if there is any thing which I am missing here.