Showing posts with label sub. Show all posts
Showing posts with label sub. Show all posts

Friday, March 30, 2012

How to trigger Snapshot and Merge Replication

I have two servers config'd for merge replication (server A is SUB, server B
is PUB)
When insert on server B table1 occur, I need trigger to exec snapshot,
followed by merge replication jobs. The jobs exist on server A.
I know how to create triggers, but not clear on how to trigger a SQL job
from server B to run from server A?
using SQL 2K5
You coyuld set up a linked server and run sp_start_job on server A using a
fully qualified name...
Cheers,
Paul Ibison
sql

Friday, March 9, 2012

How to sub total a calculated column?

In my report body, there is table, which contains a column displaying calculated data based on a field from a dataset. The expression for the cell called "calculatedCost" below this column is :

"=Iif(Fields!Facotr.Value=0, Fields!cost.Value * Fields!Quantity.Value *1,Fields!cost.Value * Fields!Quantity.Value *Fields!Factor.Value)

The data row in the table will be grouped by fields called Code like "A", "B" and etc. Now I need to sub total the above calculated column under each group, i.e. Subtotals for Code A and Code B. How can I do this? I tried the following expression:

=Sum(ReportItems("calculatedCost").Value)

But I got an error saying that Aggregate functions couldn't be used in report body. Then how can I refer the value of cell "calculatedCost"? Any suggestion will be highly appreciated..

You could perform the calculation in your dataset and not display that field.

SELECT *, (<Expression HERE>) As CalcField FROM Query

Then use that field in the summary field.

=SUM(Fields!CalcField.Value)

|||Thanks a lot. I got it work!

Sunday, February 19, 2012

How to stop SP ?

My aims is ..i want the SP do nothing . even some one call the SP
in vb.net , I can use EXIT sub or exit fucntion , so. does any code i can
put to make sp do nothing (or comment all the code instead ')
Thanks
private function...
exit function
..my code
end privateHi
RETURN is what you are looking for.
CREATE PROCEDURE ABC
AS
--The SP will exit on the next line, reporting success
RETURN 0
--Other code goes here.
GO
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Agnes" <agnes@.dynamictech.com.hk> wrote in message
news:#USWIilIFHA.1304@.TK2MSFTNGP10.phx.gbl...
> My aims is ..i want the SP do nothing . even some one call the SP
> in vb.net , I can use EXIT sub or exit fucntion , so. does any code i can
> put to make sp do nothing (or comment all the code instead ')
> Thanks
> private function...
> exit function
> ..my code
> end private
>