Showing posts with label bunch. Show all posts
Showing posts with label bunch. Show all posts

Wednesday, March 21, 2012

non-queried param problem

I know there have been a bunch of posts re: setting a param to 'All'.
I have done this successfully when using a query param but an using a
non-queried list for this project and the methods I've used in the
past such as " (cy.Division IN (@.Div) OR '(All)' in(@.Div)) " in the
dataset do not work. I get an error stating that I can't convert
'all' to an int data type.
I also tried doing multi-select but get a 'SQL error near ','"
message. I only have two actual values for the parameter plus all.
I've someone could please tell me how to get this going I'd appreciate
it.
DebraYou are confusing what is shown versus the value. If the parameter is an
integer then when putting in the parameter lis have the label be All and the
value be some value that your data never is (like 0 or a negative or
something). The important thing here is that the value cannot exist in your
data.
Then you can still do this:
select * from sometable where (somefield = @.MyParam or @.MyParam = 0)
Note that the 0 is whatever you have made the All parameter value be (-1,
9999, etc).
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Debralous" <debras@.ehtc.com> wrote in message
news:1170270898.588687.306440@.q2g2000cwa.googlegroups.com...
>I know there have been a bunch of posts re: setting a param to 'All'.
> I have done this successfully when using a query param but an using a
> non-queried list for this project and the methods I've used in the
> past such as " (cy.Division IN (@.Div) OR '(All)' in(@.Div)) " in the
> dataset do not work. I get an error stating that I can't convert
> 'all' to an int data type.
> I also tried doing multi-select but get a 'SQL error near ','"
> message. I only have two actual values for the parameter plus all.
> I've someone could please tell me how to get this going I'd appreciate
> it.
> Debra
>|||Thank you so much. Obvious once you point it out! I appreciate you
taking the time!

Saturday, February 25, 2012

nocheck when creating a constraint

i was looking at a database creation script and i have a bunch of
constraints being created with a nocheck on them. i think i know what
the nocheck does (don't check for data issues). i'm not sure why the
original coder would define them like this since there is no data to
begin with when the tables are built. am i missing something? does
this hurt the database table?
ALTER TABLE [dbo].[mytable] WITH NOCHECK ADD
CONSTRAINT [PK_mytable] PRIMARY KEY ([mytable_id]) ON [PRIMARY]That seems to be a stupid thing to do. You won't gain anything, and possibly just have a non-trusted
constraint which can lead to worse performance (non-trusted will limit some of the optimizations
that can be done).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Derek" <gepetto_2000@.yahoo.com> wrote in message
news:1178199834.825140.114810@.y5g2000hsa.googlegroups.com...
> i was looking at a database creation script and i have a bunch of
> constraints being created with a nocheck on them. i think i know what
> the nocheck does (don't check for data issues). i'm not sure why the
> original coder would define them like this since there is no data to
> begin with when the tables are built. am i missing something? does
> this hurt the database table?
>
> ALTER TABLE [dbo].[mytable] WITH NOCHECK ADD
> CONSTRAINT [PK_mytable] PRIMARY KEY ([mytable_id]) ON [PRIMARY]
>|||Derek,
See this blog from SQL Server MVP Hugo Kornelis.
Can you trust your constraints?
http://sqlblog.com/blogs/hugo_kornelis/archive/2007/03/29/can-you-trust-your-constraints.aspx
AMB
"Derek" wrote:
> i was looking at a database creation script and i have a bunch of
> constraints being created with a nocheck on them. i think i know what
> the nocheck does (don't check for data issues). i'm not sure why the
> original coder would define them like this since there is no data to
> begin with when the tables are built. am i missing something? does
> this hurt the database table?
>
> ALTER TABLE [dbo].[mytable] WITH NOCHECK ADD
> CONSTRAINT [PK_mytable] PRIMARY KEY ([mytable_id]) ON [PRIMARY]
>

nocheck when creating a constraint

i was looking at a database creation script and i have a bunch of
constraints being created with a nocheck on them. i think i know what
the nocheck does (don't check for data issues). i'm not sure why the
original coder would define them like this since there is no data to
begin with when the tables are built. am i missing something? does
this hurt the database table?
ALTER TABLE [dbo].[mytable] WITH NOCHECK ADD
CONSTRAINT [PK_mytable] PRIMARY KEY ([mytable_id]) ON [PRIMAR
Y]That seems to be a stupid thing to do. You won't gain anything, and possibly
just have a non-trusted
constraint which can lead to worse performance (non-trusted will limit some
of the optimizations
that can be done).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Derek" <gepetto_2000@.yahoo.com> wrote in message
news:1178199834.825140.114810@.y5g2000hsa.googlegroups.com...
> i was looking at a database creation script and i have a bunch of
> constraints being created with a nocheck on them. i think i know what
> the nocheck does (don't check for data issues). i'm not sure why the
> original coder would define them like this since there is no data to
> begin with when the tables are built. am i missing something? does
> this hurt the database table?
>
> ALTER TABLE [dbo].[mytable] WITH NOCHECK ADD
> CONSTRAINT [PK_mytable] PRIMARY KEY ([mytable_id]) ON [P
RIMARY]
>|||Derek,
See this blog from SQL Server MVP Hugo Kornelis.
Can you trust your constraints?
http://sqlblog.com/blogs/hugo_korne.../>
raints.aspx
AMB
"Derek" wrote:

> i was looking at a database creation script and i have a bunch of
> constraints being created with a nocheck on them. i think i know what
> the nocheck does (don't check for data issues). i'm not sure why the
> original coder would define them like this since there is no data to
> begin with when the tables are built. am i missing something? does
> this hurt the database table?
>
> ALTER TABLE [dbo].[mytable] WITH NOCHECK ADD
> CONSTRAINT [PK_mytable] PRIMARY KEY ([mytable_id]) ON [
PRIMARY]
>