Click here to Skip to main content
15,920,468 members
Home / Discussions / Database
   

Database

 
QuestionHow to identify if an SQL query times out [modified] Pin
indian14321-Nov-08 1:31
indian14321-Nov-08 1:31 
AnswerRe: How to identify if an SQL query times out Pin
Wendelius21-Nov-08 6:24
mentorWendelius21-Nov-08 6:24 
GeneralRe: How to identify if an SQL query times out Pin
indian14321-Nov-08 7:54
indian14321-Nov-08 7:54 
GeneralRe: How to identify if an SQL query times out Pin
Wendelius22-Nov-08 22:36
mentorWendelius22-Nov-08 22:36 
GeneralRe: How to identify if an SQL query times out Pin
indian14324-Nov-08 0:24
indian14324-Nov-08 0:24 
GeneralRe: How to identify if an SQL query times out Pin
Wendelius24-Nov-08 1:54
mentorWendelius24-Nov-08 1:54 
AnswerRe: How to identify if an SQL query times out Pin
Mycroft Holmes21-Nov-08 13:11
professionalMycroft Holmes21-Nov-08 13:11 
Questiondynamic sql problem Pin
Mogaambo21-Nov-08 0:10
Mogaambo21-Nov-08 0:10 
if i use asc or desc then it gives error, iwant asc and desc both ?


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <author,,name>
-- Create date: <create>
-- Description: <description,,>
-- =============================================
ALTER PROCEDURE 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(4)
)

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

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

where (@Order_no is null or @Order_no=p.Order_No)
And
(@VendorId is null or @VendorId=p.Vendor_id)
And
(@FromDate Is Null OR @ToDate Is Null
OR (@FromDate Is Not Null AND @ToDate Is Not Null
AND p.order_date BETWEEN @FromDate AND @ToDate)
)
And
p.delivered='N'

ORDER BY

CASE @Sort_order
WHEN 'Asending' THEN

CASE @Sort_by
WHEN 'Order No' THEN ORDER_NO
WHEN 'Vendor' THEN v.Vendor_Name asc
WHEN 'Date' THEN p.order_date asc
END

WHEN 'Descending' THEN

CASE @Sort_by
WHEN 'Order No' THEN ORDER_NO DESC
WHEN 'Vendor' THEN v.Vendor_Name DESC
WHEN 'Date' THEN p.order_date DESC
END
END

END
GO

“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
Ashfield21-Nov-08 1:10
Ashfield21-Nov-08 1:10 
AnswerRe: dynamic sql problem Pin
Ben Fair21-Nov-08 9:35
Ben Fair21-Nov-08 9:35 
GeneralRe: dynamic sql problem Pin
Mogaambo21-Nov-08 9:56
Mogaambo21-Nov-08 9:56 
GeneralRe: dynamic sql problem Pin
Ben Fair21-Nov-08 10:08
Ben Fair21-Nov-08 10:08 
QuestionDesgin Pin
cbe_pav20-Nov-08 21:59
cbe_pav20-Nov-08 21:59 
Questionfor searching specific records from sql server 2005 database Pin
Babuni4uonly20-Nov-08 21:38
Babuni4uonly20-Nov-08 21:38 
AnswerRe: for searching specific records from sql server 2005 database Pin
Ashfield20-Nov-08 23:36
Ashfield20-Nov-08 23:36 
AnswerRe: for searching specific records from sql server 2005 database Pin
Jerry Hammond21-Nov-08 14:15
Jerry Hammond21-Nov-08 14:15 
Generalfiltering dataset and pu the result in another datatable. Pin
Aslesh20-Nov-08 12:03
Aslesh20-Nov-08 12:03 
GeneralRe: filtering dataset and pu the result in another datatable. Pin
Ashfield20-Nov-08 20:01
Ashfield20-Nov-08 20:01 
GeneralCross-post Pin
Wendelius21-Nov-08 22:42
mentorWendelius21-Nov-08 22:42 
Questioncopying a record from one database to another database in sql server 2000 using c# Pin
Berlus20-Nov-08 11:39
Berlus20-Nov-08 11:39 
Questionconvert MS SQL DB 2008 to 2005 Pin
Aslesh20-Nov-08 9:36
Aslesh20-Nov-08 9:36 
AnswerRe: convert MS SQL DB 2008 to 2005 Pin
Wendelius20-Nov-08 9:49
mentorWendelius20-Nov-08 9:49 
AnswerRe: convert MS SQL DB 2008 to 2005 Pin
Edin Jen Raj15-Jun-10 2:05
Edin Jen Raj15-Jun-10 2:05 
AnswerRe: convert MS SQL DB 2008 to 2005 Pin
Edin Jen Raj15-Jun-10 2:06
Edin Jen Raj15-Jun-10 2:06 
QuestionCOUNT PROBLEM Pin
member2720-Nov-08 1:40
member2720-Nov-08 1:40 

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.