Viewing 15 posts - 16 through 30 (of 311 total)
Something like this?
WITH Digits(D) AS -- Digits 0 to 9
(
SELECT
D
FROM
(
VALUES (0), (1), (2), (3),...
August 6, 2013 at 11:37 am
mister.magoo (7/29/2013)
Of course, I could be wrong and will skulk away with my tail between my legs when Paul tells me I am wrong 😛
I guess Paul will tell you...
July 29, 2013 at 10:15 am
I agree with Sean that there is no bullet-proof solution for an arbitrary input set. However, if the number of dates in the input is large enough and distributed, one...
January 18, 2013 at 8:34 am
Just prefix the id's in the TreeOrder column with an appropriate number of zeros's.
Test setup
Declare @table table(SModuleId Int, ModuleId Int, SMName Varchar(100), LinkOrder Int, ParentId int, Level int, Root int,...
January 18, 2013 at 5:57 am
Another one.
select
d,
cast(stuff(stuff(replace(d, ' ', ' ' + replicate('0', 15 - len(d))), 14, 0, ':'), 12, 0, ':') as datetime) dt
from
(
values('20100228 124556'), ('20101231 52834'),...
January 18, 2013 at 5:23 am
Great. To make it a little bit more elegant you could replace the CASE expression with a COALESCE function:
SELECT
ID,
COALESCE(NULLIF(LExecuted, ''), NULLIF(LB_Submitted, ''), MAX(CAST(AnyDate AS DATETIME))) AnyDate
FROM
...
January 9, 2013 at 2:58 pm
You posted in a SQL 2008 forum, so I gave you a SQL 2008 solution. CROSS APPLY works in SQL 2005, it´s the row constructor VALUES which causes the syntax...
January 9, 2013 at 2:15 pm
One way to go:
DECLARE @T TABLE (ID INT PRIMARY KEY, SentDate VARCHAR(10), ReceivedDate VARCHAR(10), CreatedDate VARCHAR(10))
INSERT INTO
@T
VALUES
(1, NULL, '2-11-2012', NULL),
(2, '22-10-2012', NULL, '2-12-2012'),
...
January 9, 2013 at 11:27 am
You can try something like this (requires only a single table scan):
SELECT
@abc = COUNT(CASE WHEN ColumnName LIKE '%abc%' THEN 1 END),
@def = COUNT(CASE WHEN ColumnName LIKE '%def%'...
January 9, 2013 at 11:04 am
Take a look at this thread http://www.sqlservercentral.com/Forums/FindPost1313092.aspx. Paul White gives a very reasonable explanation (and solution) about this error.
November 5, 2012 at 11:09 pm
SQL Kiwi (9/14/2012)
BTW: Never post anything ever again, Peter. You have the much-coveted 'default port' status (for a point score of 1433).edit: Oh. You've changed to 'UDP Broadcaster' (1434).
Too...
September 15, 2012 at 1:53 am
ScottPletcher (9/14/2012)
September 14, 2012 at 12:49 pm
Looking at the syntax definition of the FROM clause the binding error makes perfect sense.
[ FROM { <table_source> } [ ,...n ] ]
<table_source> ::=
{
...
September 14, 2012 at 11:50 am
To do it in a single load, you can use a query like
;WITH OrderedALog AS
(
SELECT
Aid, ACode, ATimestamp,
ROW_NUMBER() OVER (PARTITION...
August 15, 2012 at 3:40 am
Assuming that the TradeID column is unique (primary key?), why not use a UNION ALL instead of UNION. This avoids a (expensive) distinct sort to filter out nonexisting duplicates. Still,...
August 12, 2012 at 3:30 am
Viewing 15 posts - 16 through 30 (of 311 total)