Viewing 15 posts - 6,736 through 6,750 (of 10,143 total)
Fast and accurate:
SELECT [FirstMonday] = DATEADD(dd,CASE x.wd WHEN 'mo' THEN 0 WHEN 'su' THEN 1 WHEN 'sa' THEN 2 WHEN 'fr' THEN 3 WHEN 'th' THEN 4 WHEN 'we' THEN...
August 18, 2011 at 5:57 am
This incorporates many of the changes suggested to date and replaces the cursor with a local temporary table.
ALTER PROCEDURE [dbo].[cust_CreateJournalEntry]
@PO_NUMBER VARCHAR(10)
...
August 18, 2011 at 3:01 am
Heh! Funny - I thought your solution had a triangular join but it isn't. That >= ALL () appears to be very efficient with this small data set. It's twice...
August 17, 2011 at 9:57 am
Sure.
SELECT
d.[rec_index],
d.file_desc,
d.is_modified
FROM (
SELECT
[rec_index],
file_desc,
is_modified,
rn = ROW_NUMBER() OVER(PARTITION BY file_desc ORDER BY rec_index...
August 17, 2011 at 9:39 am
dardar4 (8/17/2011)
insert into MyTable (file_desc, is_modified) values ('a.txt',0)
insert into MyTable (file_desc, is_modified) values ('a.txt',1)
insert into MyTable (file_desc, is_modified) values ('b.txt',0)
insert into...
August 17, 2011 at 7:20 am
Thanks for the sample data.
The simplest solution to this is the following:
SELECT
file_desc,
rec_index = MAX(rec_index)
FROM MyTable
WHERE is_modified = 0
GROUP BY file_desc
There's no need to incur the cost and...
August 17, 2011 at 5:59 am
It's a simple aggregate.
Have you read the introductory article [/url]yet?
Writing a few INSERT statements will take you seconds.
It will only take us seconds to write your query but without...
August 17, 2011 at 5:19 am
Like this:
CREATE TABLE #Sample (some_index INT, [file_name] nvarchar(50), is_modified bit)
INSERT INTO #Sample (some_index, [file_name], is_modified)
SELECT 1, 'anything.txt', 0
but with a few more rows.
Don't name a column [index], or...
August 17, 2011 at 3:36 am
dardar4 (8/17/2011)
i have a table with those columns: index[int], file_name[nvarchar(50)], is_modified [bit]
i need to write an sql statement that will do the following:
go over all the records in the...
August 17, 2011 at 3:21 am
Lowell (8/16/2011)
that post from Paul exactly encapsulates that portion of his presentation Chris, yes.
ยป Dmitri Korotkevitch's web site,...
August 17, 2011 at 1:53 am
Vlad-207446 (8/16/2011)
August 16, 2011 at 10:04 am
GSquared (8/16/2011)
August 16, 2011 at 10:00 am
It has to be easier than this. You don't need a table of weekends, you can calculate them:
DECLARE
@HolStartDate DATETIME = '17/08/2011',
@HolEndDate DATETIME = '27/08/2011'
SELECT DATEADD(dd,rn,@HolStartDate)
FROM (SELECT top 100 rn...
August 16, 2011 at 9:55 am
Lowell (8/15/2011)
the Presenter was Dimitri, and he had a great...
August 16, 2011 at 9:06 am
spin (8/16/2011)
wow. a little more complicated than i'd expected. trying to get my head around this now. i'll let you know if it works out. thanks.
It doesn't need to be...
August 16, 2011 at 7:18 am
Viewing 15 posts - 6,736 through 6,750 (of 10,143 total)