SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Store Procedure
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

atuljadhavnetafim
Starting Member

India
11 Posts

Posted - 11/06/2013 :  04:21:16  Show Profile  Reply with Quote
Dear Sir

i have database "Northwind", and Table Name "Data"
and in "Data" Table the column as per below

CustomerID
CompanyName
ContactName
OrderID
EmployeeUD
FirstName
LastName
ShippedDate
ProductName
UnitPrice
Quantity

now i have to make store procedure in programmability, and i use below code

CREATE PROCEDURE [dbo].[SP_GetOrdersForCustomer]
@CustomerID nchar(5)
AS
BEGIN
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] DESC
END

but it did not work, it give error

"Msg 208, Level 16, State 1, Procedure SP_GetOrdersForCustomer, Line 5
Invalid object name 'Customers'."

Please Help


Atul Jadhav

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 11/06/2013 :  04:34:26  Show Profile  Reply with Quote
do you've table Customers in the database?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

atuljadhavnetafim
Starting Member

India
11 Posts

Posted - 11/06/2013 :  04:42:02  Show Profile  Reply with Quote
no, i don't have

i have simple dealer wise Sales report and want to get data from that table only

Atul Jadhav
Go to Top of Page

atuljadhavnetafim
Starting Member

India
11 Posts

Posted - 11/06/2013 :  04:59:30  Show Profile  Reply with Quote
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 code

Atul Jadhav
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 11/06/2013 :  05:08:13  Show Profile  Reply with Quote
quote:
Originally posted by atuljadhavnetafim

no, i don't have

i have simple dealer wise Sales report and want to get data from that table only

Atul Jadhav


What does that mean?
Which table you want data from? I'm not getting your actual requirement
Unless you've the table Customers you wont be able to get details from it.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

atuljadhavnetafim
Starting Member

India
11 Posts

Posted - 11/06/2013 :  05:24:30  Show Profile  Reply with Quote
okey, i explain you

i 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/table

just 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 worry

i home i explain now well

Atul Jadhav
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000