Click here to Skip to main content
15,881,757 members
Home / Discussions / Database
   

Database

 
GeneralRe: Parameter in stored procedure Pin
Saiyed Alam27-Nov-08 20:42
Saiyed Alam27-Nov-08 20:42 
Questionsimple bugs, work items Addin for VS ? Pin
Ahmed Charfeddine26-Nov-08 6:16
Ahmed Charfeddine26-Nov-08 6:16 
AnswerRe: simple bugs, work items Addin for VS ? Pin
Ashfield26-Nov-08 21:44
Ashfield26-Nov-08 21:44 
QuestionHow to Unlock a table in SQL Server 2005? Pin
meeram39526-Nov-08 5:33
meeram39526-Nov-08 5:33 
AnswerRe: How to Unlock a table in SQL Server 2005? Pin
PIEBALDconsult26-Nov-08 13:46
mvePIEBALDconsult26-Nov-08 13:46 
AnswerRe: How to Unlock a table in SQL Server 2005? Pin
Ashfield26-Nov-08 21:01
Ashfield26-Nov-08 21:01 
AnswerRe: How to Unlock a table in SQL Server 2005? Pin
Wendelius27-Nov-08 3:55
mentorWendelius27-Nov-08 3:55 
QuestionDYNAMIC SQL PROBLEM Pin
Mogaambo26-Nov-08 0:55
Mogaambo26-Nov-08 0:55 
Below is my store procedure

when i call GetPurchaseOrders null, 2,null,null,'Vendor','Descending'

it gives error

"Conversion failed when converting datetime from character string"


set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

-- =============================================
-- Author: <author,,name>
-- Create date: <create>
-- Description: <description,,>
-- =============================================
ALTER PROCEDURE [dbo].[GetPurchaseOrders]
-- Add the parameters for the stored procedure here
(
@Order_no bigint,
@VendorId int,
@FromDate datetime,
@ToDate datetime,
@Sort_by varchar(15),
@Sort_order varchar(15)
)

AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;


SELECT p.Order_No as OrderNo,v.Vendor_Name as [Vendor], Order_date as OrderDate from
Purchase p
join
Vendor as v
on p.Vendor_ID=v.Vendor_ID

where p.Order_No=COALESCE(@Order_no,p.Order_No)And
p.Vendor_id =COALESCE(@VendorId , p.Vendor_id )And p.delivered='N'

ORDER BY
CASE @Sort_by
WHEN 'Order No' THEN p.ORDER_NO
WHEN 'Date' THEN p.order_date
WHEN 'Vendor' THEN v.Vendor_Name
END desc
end

“You will never be a leader unless you first learn to follow and be led.”
–Tiorio

"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford

AnswerRe: DYNAMIC SQL PROBLEM Pin
Umair Feroze26-Nov-08 3:24
Umair Feroze26-Nov-08 3:24 
AnswerRe: DYNAMIC SQL PROBLEM Pin
Ben Fair26-Nov-08 3:26
Ben Fair26-Nov-08 3:26 
QuestionUse if else statements to retrieve a certain column based on criteria and give it for display Pin
nit11525-Nov-08 11:30
nit11525-Nov-08 11:30 
AnswerRe: Use if else statements to retrieve a certain column based on criteria and give it for display Pin
Pete O'Hanlon25-Nov-08 12:22
mvePete O'Hanlon25-Nov-08 12:22 
AnswerRe: Use if else statements to retrieve a certain column based on criteria and give it for display Pin
PIEBALDconsult26-Nov-08 13:49
mvePIEBALDconsult26-Nov-08 13:49 
QuestionDynamic sql Query Pin
shinboxe25-Nov-08 6:09
shinboxe25-Nov-08 6:09 
AnswerRe: Dynamic sql Query Pin
Ben Fair25-Nov-08 9:35
Ben Fair25-Nov-08 9:35 
GeneralRe: Dynamic sql Query Pin
shinboxe25-Nov-08 10:15
shinboxe25-Nov-08 10:15 
GeneralRe: Dynamic sql Query Pin
Ashfield25-Nov-08 21:17
Ashfield25-Nov-08 21:17 
GeneralRe: Dynamic sql Query Pin
Umair Feroze26-Nov-08 3:44
Umair Feroze26-Nov-08 3:44 
QuestionRe: Dynamic sql Query Pin
Ashfield26-Nov-08 8:36
Ashfield26-Nov-08 8:36 
AnswerRe: Dynamic sql Query Pin
shinboxe27-Nov-08 7:47
shinboxe27-Nov-08 7:47 
QuestionVista Home Premium - install SQL 2005 Express with Reporting Service? Pin
devvvy25-Nov-08 5:24
devvvy25-Nov-08 5:24 
AnswerRe: Vista Home Premium - install SQL 2005 Express with Reporting Service? Pin
Jerry Hammond25-Nov-08 18:19
Jerry Hammond25-Nov-08 18:19 
QuestionIs having an error handler in every single stored procedure excessive? Pin
emunews25-Nov-08 3:21
emunews25-Nov-08 3:21 
AnswerRe: Is having an error handler in every single stored procedure excessive? Pin
Ashfield25-Nov-08 5:21
Ashfield25-Nov-08 5:21 
GeneralRe: Is having an error handler in every single stored procedure excessive? Pin
emunews25-Nov-08 10:59
emunews25-Nov-08 10:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.