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

Tuesday, March 20, 2012

Plz Help me out in this query

Declare @.i int
Select @.i=D_Places from MachineTests Where Test_Name='WBC_Count'
--Where D_Places is a user defined Number which defines the scale for
this Test
--While Converting it to Decimal

-- What does the following query do
-- I need to check the flag FORCE_HOLD_NDR if its 1 then
-- conversion is done on Result field of MachineResults Table

Select Case(FORCE_HOLD_NDR)
WHEN 1 THEN convert(DECIMAL(18,@.i), Result)
ELSE Result
END

Quote:

Originally Posted by

>From MachineResults


--Sounds really easy :) but its prompting me an Error
--"Server: Msg 170, Level 15, State 1, Line 5
--"Line 5: Incorrect syntax near '@.i'."

/*
So the problem i m facing is in supplying a variable (@.i in this case)
in Decimal constructor..

Is there any solution to remove this error however the bussiness
requiremt cant be
changed as the scale for the decimal is defined by the user in setup
file and it
can be anything ..

*/
Hope u guys Understand my question

Regards
Mohammad Rehan
Nortec Softwares Pvt LTDAm 17 Nov 2006 05:22:51 -0800 schrieb Roni:
...

Quote:

Originally Posted by

Select Case(FORCE_HOLD_NDR)
WHEN 1 THEN convert(DECIMAL(18,@.i), Result)
ELSE Result
END

Quote:

Originally Posted by

>>From MachineResults


>
--Sounds really easy :) but its prompting me an Error
--"Server: Msg 170, Level 15, State 1, Line 5
--"Line 5: Incorrect syntax near '@.i'."
>


This is not possible, you have to build a string and then execute this
string using EXECUTE or sp_executesql.
Here is an excellent article about it:
http://www.sommarskog.se/dynamic_sql.html
bye,
Helmut

Friday, March 9, 2012

Please suggest!

Hi,
While using Reporting services, I have come across the following situation
where the grouping cirteria for the report is defined by the user using ASPX
page.
My problem is, I am not sure how I can send the the grouping preferences to
the Reporting service(I can't send this data as a part of Report parameters
as there is no limit on the number of groups permitted).
Thanks,
RajRaj,
Reports are cheap, and take up no space at all. So make as many reports as
you need that will satisfy your grouping options. On the ASPX have the user
select the grouping options, and your will the call the appropriate report by
name.
rwiethorn
"Raj" wrote:
> Hi,
> While using Reporting services, I have come across the following situation
> where the grouping cirteria for the report is defined by the user using ASPX
> page.
> My problem is, I am not sure how I can send the the grouping preferences to
> the Reporting service(I can't send this data as a part of Report parameters
> as there is no limit on the number of groups permitted).
> Thanks,
> Raj|||Thanks for the reply, rwiethorn.
The solution that you have suggested may not be too practical in my
application as the grouping is quite dynamic and its impossible to create all
the reports at design time.
Thanks again,
Raj
"rwiethorn" wrote:
> Raj,
> Reports are cheap, and take up no space at all. So make as many reports as
> you need that will satisfy your grouping options. On the ASPX have the user
> select the grouping options, and your will the call the appropriate report by
> name.
>
> rwiethorn
>
> "Raj" wrote:
> > Hi,
> >
> > While using Reporting services, I have come across the following situation
> > where the grouping cirteria for the report is defined by the user using ASPX
> > page.
> >
> > My problem is, I am not sure how I can send the the grouping preferences to
> > the Reporting service(I can't send this data as a part of Report parameters
> > as there is no limit on the number of groups permitted).
> >
> > Thanks,
> > Raj

Wednesday, March 7, 2012

Please help: Views and INSTEAD OF UPDATE trigger

Hi:

Currently I have two tables T1 and T2. A view V1 is defined over T1 with an INSTEAD OF UPDATE trigger and another view V2 is defined over V1 and T2 with another INSTEAD OF UPDATE trigger. Unfortunately, inside V2s trigger following update statement is not working:
Update V1 set V1.name = i.name from inserted i
because SQL server complains:
View 'V1' has an INSTEAD OF UPDATE trigger and cannot be a target of an UPDATE FROM statement.
Is there any way to get around this problem? I.e., how can I make the INSTEAD OF UPDATE trigger in V2 to work if I cant reference inserted?

Your help is appreciated,

JeffI think the problem is not with your "inserted" table, but with the target of the insert (View V1).

Modify your INSTEAD OF triggers so that they reference the underlying tables directly, rather than through secondary views.