Viewing 15 posts - 3,451 through 3,465 (of 10,144 total)
Always start simple:
SELECT *
FROM Car
WHERE Price IN (@Price1,@price2,@price3)
AND Manufacture IN (@Manufacture1,@Manufacture2,@Manufacture3)
AND Model IN (@Model1,@Model2,@Model3)
AND City IN (@City1,@City2,@City3)
April 16, 2014 at 1:46 am
EasyBoy (4/15/2014)
I did try almost all combination of altering columns for index, but somehow logical reads are same (67000).
Did you look at the execution plans to see if the hash...
April 16, 2014 at 1:40 am
Your query filters out a very small number of rows from the table - you may as well scan them all from an index ordered by , which should give...
April 15, 2014 at 6:04 am
Using Eirikur's data set, here's a different way:
;WITH MyOriginalQuery AS ( -- a query which contains related records of payments made grouped by month and year
SELECT PAYMENT_ID, MEMBER_ID, [Year] =...
April 15, 2014 at 3:29 am
yuvipoy (4/14/2014)
Sure will follow ANSI 92 standard and thanks for the suggestion.How about the execution plan
95% of the cost of the query is a key lookup of table2. The query...
April 15, 2014 at 2:06 am
Miller (4/14/2014)
CREATE FUNCTION [dbo].[BetterSplit]
(
@L NVARCHAR(MAX)
,@D NVARCHAR(100)
)
RETURNS TABLE WITH SCHEMABINDING AS
RETURN
WITH
--A,B,C,D used to generate large number of rows...
April 14, 2014 at 9:55 am
bryan van ritter (4/12/2014)
and print for each record a insert statement so i can insert the records into table two....
April 14, 2014 at 6:16 am
Miller (4/13/2014)
CREATE FUNCTION [dbo].[BetterSplit]
(@L NVARCHAR(MAX),@D NVARCHAR(100))
RETURNS TABLE AS RETURN
WITH A(N)AS(SELECT 1UNION ALL SELECT...
April 14, 2014 at 3:26 am
SELECT
[Open] = SUM(CASE WHEN DocStatus = 'Active' THEN 1 ELSE 0 END),
[Closed] = SUM(CASE WHEN DocStatus = 'Retired' THEN 1 ELSE 0 END)
FROM Document
CROSS APPLY (
SELECT
CurrentDateFiscalYear =...
April 11, 2014 at 9:58 am
Better to use an explicit conversion of string-date to actual date, than hope that local settings will accidentally give you the result you want with an implicit conversion.
CONVERT(DATE,po_date,101)
April 11, 2014 at 8:00 am
aar.mba (4/11/2014)
Actually I want the user to give values in runtime. Those two(@fromdate and @todate) are parameters.For testing purpose I gave date ranges in literals.
its Jan 04 2012.MM/DD/YYYY format
What do...
April 11, 2014 at 7:29 am
declare @todate as date = '01/04/2012'
Is this meant to be April 1st or January 4th?
Why do you prepare two date variables, then use literals in your query?
April 11, 2014 at 7:19 am
BWFC (4/11/2014)
April 11, 2014 at 6:25 am
aar.mba (4/11/2014)
I tried somewhat like this.
SELECT LOCATION,SUM(SHIPQTY) LATE_QTY ,PO_DATE FROM mytable WHERE DROP_DATE_STATUS = 'LATE'
AND SUBSTRING(CAST(PO_DATE AS VARCHAR(11)),1,2) + '/' + SUBSTRING(CAST(PO_DATE AS...
April 11, 2014 at 5:34 am
Couple of errors in there, BWFC:
DECLARE @FromDate DATE = '2012-01-19'
DECLARE @ToDate DATE = '2012-02-23'
-- CONVERT po_date to DATE for the comparison,
-- using the correct STYLE argument for mm/yy/dddd
SELECT...
April 11, 2014 at 5:20 am
Viewing 15 posts - 3,451 through 3,465 (of 10,144 total)