Jump to content

jones77622

Members
  • Posts

    22
  • Joined

  • Last visited

jones77622's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Thanks for all your help my instructor said it was great.
  2. would this be the correct syntax??USE GO/****** Object: UserDefinedFunction [dbo].[CalculateTotal] Script Date: 11/21/2013 17:42:13 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOALTER FUNCTION [dbo].[CalculateTotal]()RETURNS moneyASBEGIN DECLARE @totalcost money; SELECT @totalcost = (crustprice + Sideprice + Toppingprice) FROM dbo.Crusttable, dbo.SidesTable, dbo.ToppingsTable, dbo.order1LEFT JOIN crusts AS c ON o.crust=c.crustIDLEFT JOIN toppings AS t ON o.toppings=t.toppingIDLEFT JOIN sides AS s ON o.sides=s.sideID Return @totalcost END
  3. can you help me write the correct syntax for that join command thanks
  4. i made this function do you think this would work for me? USE GO/****** Object: UserDefinedFunction [dbo].[CalculateTotal] Script Date: 11/21/2013 17:42:13 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOALTER FUNCTION [dbo].[CalculateTotal]()RETURNS moneyASBEGIN DECLARE @totalcost money; SELECT @totalcost = (crustprice + Sideprice + Toppingprice) FROM dbo.Crusttable, dbo.SidesTable, dbo.ToppingsTable, dbo.order1 Return @totalcost END
  5. can you help me figure out what the correct syntax would be for those triggers???
  6. Here is the transact code i cant seem to get it to work properly USE GO/****** Object: Trigger [dbo].[Trigger1] Script Date: 11/21/2013 10:31:57 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGO-- =============================================-- Author: Name-- Create date:-- Description: -- =============================================ALTER TRIGGER [dbo].[Trigger1] ON [dbo].[order1] AFTER INSERT,UPDATEASBEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for trigger hereSELECT Crust, Toppings, Sides, Crustprice + ToppingPrice + SidePrice as TotalCost FROM order1, Crusttable, ToppingsTable, SidesTableEND
  7. i am having trouble making a trigger for the order table can you help me with the syntax please?
  8. i would like to execute this function every time i enter a new row in the order table. my guess is that i need to create a function then create a trigger to activate that function every time i enter a new row into the order table. am i correct?
  9. can i use the same idea in creating a function??
  10. well i have a table that doesn't have anything in it yet then i have a table that i am using for testing purposes
  11. what would the correct syntax be for an insert into statement??
  12. what about using a multistatement table-valued function ??
  13. i have been looking for a few weeks on how to do this i am working on this for a project for my SQL class as extra credit to boost my grade.
  14. SQL management studio i believe it is SQL server 2008 r2
×
×
  • Create New...