Viewing 15 posts - 1 through 15 (of 15 total)
Shouldn't be too hard using Linq...
using System.Linq;
[Microsoft.SqlServer.Server.SqlFunction(FillRowMethodName = "clrNGLoop_FillRow", TableDefinition = "Position int, Token nvarchar(4000)")]
public static IEnumerable clrNGLoop(SqlString...
June 16, 2016 at 11:07 pm
Example below using a CASE statement
Assuming phone numbers are entirely numeric:
;
WITH PhoneNumbers AS (
SELECT *
FROM (
VALUES ( 911234567891 ),( 1234567891 ),( 911234567891 ),( 1234567891 )
) PhoneNumbers(Number)
)
SELECT FORMAT( X.Number, '###-###-###' )
FROM...
June 9, 2016 at 10:22 pm
Not sure about your Id standard, but if you can extract it then you could use DENSE_RANK
E.g.
SELECT ID
FROM
(
SELECT *, DENSE_RANK( ) OVER ( ORDER BY CAST( RIGHT( ID, LEN(...
May 18, 2016 at 10:06 pm
Depending on number of rows, and indexes etc... but I would usually do a "GROUP BY" to identify dupes together with MIN to identify original record, then joining back onto...
May 8, 2016 at 8:31 pm
This is one way of doing it.
DECLARE @Customers TABLE ( Col1 varchar(50), Col2 varchar(50), Col3 varchar(50) )
INSERT INTO @Customers ( Col1, Col2, Col3 )
VALUES ( 'Value from Col1 in Table...
May 8, 2016 at 8:16 pm
Yeah, loop is a bad idea.
I think the data represents a month (even though he's limited it to 30 )...my guess is he's trying to pivot the data
E.g.
--assuming data is...
April 29, 2016 at 5:55 pm
I notice that you're looking for multiple seasons for same ID
I.e. If ID has both Season16 and Season 15 then Flag is 0 else 1.
Since row with id = 3...
April 27, 2016 at 11:26 pm
Change "CONVERT(VARCHAR(8), MAX(PA.LastModifiedDate, 112)) AS DateSent"
to "CONVERT(VARCHAR(8), MAX(PA.LastModifiedDate), 112) AS DateSent"
April 21, 2016 at 7:16 am
So much looks wrong with so little...
From what I can see:
- In your first procedure, Change to "GROUP BY", and return MAX( PolicyAudit.LastModifiedDate ) - made assumption that LastModifiedDate increases...
April 21, 2016 at 6:51 am
I'd probably use a CROSS APPLY in this instance...
e.g.
WITH Data AS
(
SELECT 1 AS ID, '1/1/1900' AS Date
UNION ALL SELECT 2, '1/1/1900'
UNION ALL SELECT 3, getdate()
UNION ALL SELECT 4, Getdate()
)
SELECT D.*,...
April 20, 2016 at 6:14 pm
I think I understand what you're after, I also think your approach is wrong. But if you're really stuck, sounds like you need to dynamically work out the dynamic SQL...
January 4, 2010 at 11:25 pm
Not sure what you're after, but is this it?
create table #Target(id int, TargetID int, ItemID varchar(3), Target int)
insert into #Target
select 1,1,'ABC',5 union all
select 2,1,'CBA',90 union all
select 3,1,'DAB',5
create table #Actuals(id int,...
September 21, 2007 at 1:19 am
Little late, but...
here's another approach comparing min and max values...
SELECT CASE WHEN MIN_JobNumber = MAX_JobNumber THEN 'One EndPoint' ELSE '2+ EndPoint' END, SUM(x)
FROM (SELECT 1 x, MIN(JobNumber) MIN_JobNumber, MAX(JobNumber) MAX_JobNumber...
September 19, 2007 at 6:02 pm
Had some spare time, here's a solution to your problem.
I think results are correct, hope solution isn't too long winded.
results selected are:
empid Missing dates description
----------- ------------- -----------
1 01...
August 20, 2007 at 8:59 pm
Don't know if this is still relevant for you, but output of following query will give you the required SQL statements:
SELECT 'SELECT * FROM [' + sysU.name + '].[' +...
June 5, 2007 at 11:28 pm
Viewing 15 posts - 1 through 15 (of 15 total)