Viewing 15 posts - 1 through 15 (of 355 total)
Here are 2 ways:
SELECT
N,
STUFF(
CASE WHEN (N & 1) > 0 THEN ',Bit1' ELSE '' END
...
May 4, 2011 at 3:50 am
If you're forced to work with this denormalised method of storage, then you split the bit flags out into separate columns using the following query that should be faster than...
May 3, 2011 at 5:14 am
In most circumstances it's not a good idea to store concatenated values in a base table. It will cause pain if you ever need to split the concatenated column into...
March 25, 2011 at 7:46 am
I'm not completely sure what you are trying to do, but have you tried using the FOR XML PATH('') technique?
CREATE TABLE #P (ProblemID int, OverallPlan varchar(50))
INSERT #P (ProblemID, OverallPlan)
SELECT 1,...
March 23, 2011 at 2:50 pm
You can group by the expression:
DATEADD(hour, DATEDIFF(hour, 0, XDateTime), 0)
e.g.
SELECT
DATEADD(hour, DATEDIFF(hour, 0, XDateTime), 0) AS XHour,
AVG(XValue) AS XAvg
FROM MyTable
GROUP BY DATEADD(hour, DATEDIFF(hour, 0,...
March 23, 2011 at 2:19 pm
I had to tweak your DDL and test data insert statements to get them to work for me...
CREATE TABLE tblCount (
TrafficId int NOT NULL IDENTITY(1,1) PRIMARY KEY,
...
March 23, 2011 at 1:05 pm
Assuming that the id column is a unique or primary key column, it seems to me that your complex query:
SELECT
CASE t1.is_transferred WHEN 0 THEN t1.transferred_from_phone_no
...
February 2, 2011 at 3:52 pm
Does this do what you want?
select
MAX(payrolldate) AS [payrolldate],
dateadd(dd,
((datediff(dd, '17530107', MAX(payrolldate))/7)*7)+7,
...
February 2, 2011 at 3:04 pm
A couple of points to check:
If there is a possibility of gaps in the integer values of the Counter column for a given patient episode, then the query will need...
January 28, 2011 at 12:24 pm
If you are using SQL Server 2005 or 2008, this method using ROW_NUMBER() might work for you:
;WITH cteSEQ AS (
SELECT
Patient,...
January 28, 2011 at 11:13 am
If your Ship_Date column is of type datetime then you don't need to worry about the extra complication that is introduced by splitting the date into year and month components.
The...
January 21, 2011 at 1:40 pm
Here are some alternative methods.
You could create a View from your #veg_tab and #non_veg_tab tables, that includes an additional column (stype) indicating the original source table of the row ('N'...
January 21, 2011 at 8:00 am
Thanks Jeff
I just compared the performance for a table with a few thousand rows, and you're quite right.
I use the method I presented because I sometimes write code that still...
January 14, 2011 at 2:30 pm
Something like this should do for a character data type column. A numeric datatype column would just need a cast to a varchar (or nvarchar).
DECLARE @MyList varchar(max)
SET @MyList = ''
SELECT...
January 14, 2011 at 1:25 pm
A developer here gave me some insight to the query i needed to create. The comparison needed to be between the min record and the next available record and compare...
January 14, 2011 at 12:59 pm
Viewing 15 posts - 1 through 15 (of 355 total)