Showing posts with label orders. Show all posts
Showing posts with label orders. Show all posts

Friday, March 30, 2012

How to create simple insert trigger

I have just one table but need to create a trigger that takes place after an update on the Orders table. I need it to multiply two columns and populate the 3rd column (total cost) with the result as so:

Orders

ProductPrice ProductQuantity TotalCost
-- --
£2.50 2
£1.75 3
£12.99 2

Can anyone please help me?You don't need a trigger, you need a computed column:

CREATE TABLE [dbo].[xxx](
[col_a] [int] NOT NULL default(2),
[col_b] [int] NOT NULL default(2),
[col_axb] as a * b,
) ON [PRIMARY]
GO|||Thank you for the help!

Monday, March 19, 2012

How to create a report using multiple databases

I have two database:

FoxPro database - contains client info (name, address)

SQL Server database - contains appointmetns, orders, jobs etc.

How can I create reports using both databases?

Thank you

You can have report datasets connected to different data sources. You can use subreports if you need to link them, e.g show appointments by client. The other option is to join datasets at the SQL Server level using OPENROWSET().|||

Is there a way to have data from both databases in one dataset?

I need to provide reports like: weekly sales by consultant - it has to be a list of customers (names) and total $ amounts sold grouped by product category.

I

|||The linked server option (OPENROWSET or OPENQUERY) will allow you do this at the SQL Server level. Alternatively, you can implement a CLR stored procedure (assuming SQL Server 2005) which can prep the dataset. Finally, you can write a SSRS custom data extension to merge the datasets.

Monday, March 12, 2012

How to create a group on selected report parameters?

Hello,
Using SSRS 2005 SP2, I have a report that has a multivalue parameter of US
states in a report that returns orders.
I successfully can return order numbers along with the associated state
where the order was placed.
However, if I select the states of NH, VT, and MA and there are no orders
from VT, I still need a group header for VT to show that there was no data
for VT. So my thought was to create a report grouping based on the states
selected in the multivalue State parameter. I can't find a way to do this.
Also, I know I could use a subreport to resolve this but it is not an option
here. I need this report to be exported to MS Excel and subreports do not
export to Excel.
Thank you,
JustinOn Oct 3, 3:48 pm, justinsaraceno
<justinsarac...@.discussions.microsoft.com> wrote:
> Hello,
> Using SSRS 2005 SP2, I have a report that has a multivalue parameter of US
> states in a report that returns orders.
> I successfully can return order numbers along with the associated state
> where the order was placed.
> However, if I select the states of NH, VT, and MA and there are no orders
> from VT, I still need a group header for VT to show that there was no data
> for VT. So my thought was to create a report grouping based on the states
> selected in the multivalue State parameter. I can't find a way to do this.
> Also, I know I could use a subreport to resolve this but it is not an option
> here. I need this report to be exported to MS Excel and subreports do not
> export to Excel.
> Thank you,
> Justin
>From your description, you will most likely want to insert dummy rows
in the returned dataset from the stored procedure/query that is
sourcing the report based on the parsing out of the multi-select
parameter. Hope this helps.
Regards,
Enrique Martinez
Sr. Software Consultant|||Thank you Enrique. It's not the answer I wanted to hear but I suppose it's a
possible solution. I wish there was a better way than having to manipulate
my dataset with dummy data. Thank you again.
"EMartinez" wrote:
> On Oct 3, 3:48 pm, justinsaraceno
> <justinsarac...@.discussions.microsoft.com> wrote:
> > Hello,
> > Using SSRS 2005 SP2, I have a report that has a multivalue parameter of US
> > states in a report that returns orders.
> >
> > I successfully can return order numbers along with the associated state
> > where the order was placed.
> >
> > However, if I select the states of NH, VT, and MA and there are no orders
> > from VT, I still need a group header for VT to show that there was no data
> > for VT. So my thought was to create a report grouping based on the states
> > selected in the multivalue State parameter. I can't find a way to do this.
> >
> > Also, I know I could use a subreport to resolve this but it is not an option
> > here. I need this report to be exported to MS Excel and subreports do not
> > export to Excel.
> >
> > Thank you,
> > Justin
>
> >From your description, you will most likely want to insert dummy rows
> in the returned dataset from the stored procedure/query that is
> sourcing the report based on the parsing out of the multi-select
> parameter. Hope this helps.
> Regards,
> Enrique Martinez
> Sr. Software Consultant
>|||Hi,
I have the same problem. Did you find any solution to that?
--
Thanks,
Tabbey
"justinsaraceno" wrote:
> Thank you Enrique. It's not the answer I wanted to hear but I suppose it's a
> possible solution. I wish there was a better way than having to manipulate
> my dataset with dummy data. Thank you again.
> "EMartinez" wrote:
> > On Oct 3, 3:48 pm, justinsaraceno
> > <justinsarac...@.discussions.microsoft.com> wrote:
> > > Hello,
> > > Using SSRS 2005 SP2, I have a report that has a multivalue parameter of US
> > > states in a report that returns orders.
> > >
> > > I successfully can return order numbers along with the associated state
> > > where the order was placed.
> > >
> > > However, if I select the states of NH, VT, and MA and there are no orders
> > > from VT, I still need a group header for VT to show that there was no data
> > > for VT. So my thought was to create a report grouping based on the states
> > > selected in the multivalue State parameter. I can't find a way to do this.
> > >
> > > Also, I know I could use a subreport to resolve this but it is not an option
> > > here. I need this report to be exported to MS Excel and subreports do not
> > > export to Excel.
> > >
> > > Thank you,
> > > Justin
> >
> >
> > >From your description, you will most likely want to insert dummy rows
> > in the returned dataset from the stored procedure/query that is
> > sourcing the report based on the parsing out of the multi-select
> > parameter. Hope this helps.
> >
> > Regards,
> >
> > Enrique Martinez
> > Sr. Software Consultant
> >
> >|||I didn't find anything better than creating some dummy data via something
like a temp table. If SSRS supported export to excel for reports with
subreports, there wouldn't be such a hack to get around this.
"tabbey" wrote:
> Hi,
> I have the same problem. Did you find any solution to that?
> --
> Thanks,
> Tabbey
>
> "justinsaraceno" wrote:
> > Thank you Enrique. It's not the answer I wanted to hear but I suppose it's a
> > possible solution. I wish there was a better way than having to manipulate
> > my dataset with dummy data. Thank you again.
> >
> > "EMartinez" wrote:
> >
> > > On Oct 3, 3:48 pm, justinsaraceno
> > > <justinsarac...@.discussions.microsoft.com> wrote:
> > > > Hello,
> > > > Using SSRS 2005 SP2, I have a report that has a multivalue parameter of US
> > > > states in a report that returns orders.
> > > >
> > > > I successfully can return order numbers along with the associated state
> > > > where the order was placed.
> > > >
> > > > However, if I select the states of NH, VT, and MA and there are no orders
> > > > from VT, I still need a group header for VT to show that there was no data
> > > > for VT. So my thought was to create a report grouping based on the states
> > > > selected in the multivalue State parameter. I can't find a way to do this.
> > > >
> > > > Also, I know I could use a subreport to resolve this but it is not an option
> > > > here. I need this report to be exported to MS Excel and subreports do not
> > > > export to Excel.
> > > >
> > > > Thank you,
> > > > Justin
> > >
> > >
> > > >From your description, you will most likely want to insert dummy rows
> > > in the returned dataset from the stored procedure/query that is
> > > sourcing the report based on the parsing out of the multi-select
> > > parameter. Hope this helps.
> > >
> > > Regards,
> > >
> > > Enrique Martinez
> > > Sr. Software Consultant
> > >
> > >|||On Oct 4, 8:08 am, justinsaraceno
<justinsarac...@.discussions.microsoft.com> wrote:
> Thank you Enrique. It's not the answer I wanted to hear but I suppose it's a
> possible solution. I wish there was a better way than having to manipulate
> my dataset with dummy data. Thank you again.
> "EMartinez" wrote:
> > On Oct 3, 3:48 pm, justinsaraceno
> > <justinsarac...@.discussions.microsoft.com> wrote:
> > > Hello,
> > > Using SSRS 2005 SP2, I have a report that has a multivalue parameter of US
> > > states in a report that returns orders.
> > > I successfully can return order numbers along with the associated state
> > > where the order was placed.
> > > However, if I select the states of NH, VT, and MA and there are no orders
> > > from VT, I still need a group header for VT to show that there was no data
> > > for VT. So my thought was to create a report grouping based on the states
> > > selected in the multivalue State parameter. I can't find a way to do this.
> > > Also, I know I could use a subreport to resolve this but it is not an option
> > > here. I need this report to be exported to MS Excel and subreports do not
> > > export to Excel.
> > > Thank you,
> > > Justin
> > >From your description, you will most likely want to insert dummy rows
> > in the returned dataset from the stored procedure/query that is
> > sourcing the report based on the parsing out of the multi-select
> > parameter. Hope this helps.
> > Regards,
> > Enrique Martinez
> > Sr. Software Consultant
You're welcome. Sorry that I could not be of greater assistance.
Regards,
Enrique Martinez
Sr. Software Consultant