Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
atuljadhavnetafim
Starting Member
25 Posts |
Posted - 2013-11-06 : 04:21:16
|
Dear Siri have database "Northwind", and Table Name "Data" and in "Data" Table the column as per belowCustomerIDCompanyNameContactNameOrderIDEmployeeUDFirstNameLastNameShippedDateProductNameUnitPriceQuantitynow i have to make store procedure in programmability, and i use below code CREATE PROCEDURE [dbo].[SP_GetOrdersForCustomer] @CustomerID nchar(5)ASBEGIN SELECT cst.[CustomerID], cst.[CompanyName], cst.[ContactName], ord.[OrderID], ord.[EmployeeID], emp.[FirstName], emp.[LastName], ord.[ShippedDate], prd.[ProductName], od.[UnitPrice], od.[Quantity] FROM [Customers] cst, [Orders] ord, [Order Details] od, [Employees] emp, [Products] prd WHERE ord.[CustomerID] = cst.[CustomerID] AND emp.[EmployeeID] = ord.[EmployeeID] AND od.[OrderID] = ord.[OrderID] AND prd.[ProductID] = od.[ProductID] AND cst.[CustomerID] = @CustomerID ORDER BY cst.[CustomerID], emp.[EmployeeID], ord.[ShippedDate] DESCEND but it did not work, it give error"Msg 208, Level 16, State 1, Procedure SP_GetOrdersForCustomer, Line 5Invalid object name 'Customers'."Please HelpAtul Jadhav |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-11-06 : 04:34:26
|
do you've table Customers in the database?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
atuljadhavnetafim
Starting Member
25 Posts |
Posted - 2013-11-06 : 04:42:02
|
no, i don't havei have simple dealer wise Sales report and want to get data from that table onlyAtul Jadhav |
|
|
atuljadhavnetafim
Starting Member
25 Posts |
Posted - 2013-11-06 : 04:59:30
|
Please give me code to get data from this table only,i have more then 5lk data, and want to export only from customerID i.e. dealer codeAtul Jadhav |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-11-06 : 05:08:13
|
quote: Originally posted by atuljadhavnetafim no, i don't havei have simple dealer wise Sales report and want to get data from that table onlyAtul Jadhav
What does that mean? Which table you want data from? I'm not getting your actual requirementUnless you've the table Customers you wont be able to get details from it.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
atuljadhavnetafim
Starting Member
25 Posts |
Posted - 2013-11-06 : 05:24:30
|
okey, i explain youi have Dealer wise sales from last 3 Years day wise, and that is more then 5lk row item, if i store in my local folder it will be very heavy file, os i store my table in SQL Server, and now i have macro (in local file) which will Call Store procedure in SQL server and that data will show in my local file, but in that my basie store procedure not wokring and i have downloded this code from net. in my table having all the data no need to depend to another file/tablejust to run single dealer data in SQL and that data will show in my local file but to show in local excel file that is second step, my store procedure enven not working in SQL query, so i am worryi home i explain now wellAtul Jadhav |
|
|
|
|
|
|
|