Viewing 15 posts - 7,696 through 7,710 (of 8,731 total)
No need for a loop. Here's another option that will work with 2 values per line. For more values, you would need to do some changes.
For the code of dbo.DelimitedSplit8K...
September 19, 2013 at 8:55 am
There's not an "official" version. However, the expected version is the current version (2012 at the moment) and 2 previous major versions (2005 and 2008).
The question might have needed...
September 19, 2013 at 8:33 am
Put your fisrt query in a subquery or a CTE (Common table expression).
Then use a (Non-Equi) JOIN using BETWEEN for the ranges and equal for the products.
September 18, 2013 at 5:49 pm
Am I missing something or would something like this will work correctly and much faster than the cursor?
CREATE TABLE #OldCustomers(
OldCustomerID int,
OldAccountNum varchar(100),
FullName varchar(100),
Addressvarchar(100))
CREATE TABLE #NewCustomers(
NewCustomerID int,
AccountID int,
FullName varchar(100),
Addressvarchar(100))
CREATE TABLE #Accounts(
AccountID...
September 18, 2013 at 3:23 pm
Check the following links on using dynamic cross tabs (dynamic pivoting) as they might help you on your problem.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns[/url]
September 18, 2013 at 3:15 pm
This post looks really related to this other
http://www.sqlservercentral.com/Forums/Topic1495877-391-1.aspx
Is it really about different things? or are you deciphering my code?
September 18, 2013 at 2:55 pm
patrickmcginnis59 10839 (9/18/2013)
Nice job on the code Luis!
Thank you. Now let's hope that kalikoi can understand it or post any questions he/she has. 🙂
September 18, 2013 at 9:07 am
I might be overcomplicating something but here's another way to do it.
CREATE TABLE #Input
(
String varchar(15)
)
INSERT INTO #Input
SELECT *
FROM (VALUES('Ørstedsvej 7B'),('Volvo 25D'),('104ND Nokia'))x(x);
WITH E1(N) AS (
...
September 18, 2013 at 9:02 am
Using the correct datatypes might help to simplify the solution.
CREATE TABLE #THREECOLS
(
COL1 TIME,
COL2 TIME,
COL3 INT
)
INSERT INTO #THREECOLS
SELECT '11:30','13:30',15
UNION ALL
SELECT '00:10','01:40',5;
WITH E1(N) AS (
...
September 18, 2013 at 8:49 am
I need some coffee :doze: I calculated the type instead of the hours and got it wrong.
September 18, 2013 at 8:24 am
The query seems complicated but the pivot is really simple. Personally, I prefer CROSS TABS. You can read more about them on this article http://www.sqlservercentral.com/articles/T-SQL/63681/
and here's an example:
SELECT IsNull(St.alternateStudyCode,...
September 16, 2013 at 8:41 am
I wouldn't rely on the float conversion. Instead you could CAST as DATE and TIME. Those datatypes can give you just the information you need. Or a direct conversion to...
September 16, 2013 at 8:17 am
Would this article help you?
September 16, 2013 at 8:10 am
The easiest way is to do it (at least for me) is with a UNION ALL or a CROSS APPLY "unpivot"
WITH Sample_Data(EmpNo, DutyId, StartDate, EndDate) AS(
SELECT 101,
'01',
CAST( '2013-08-31...
September 16, 2013 at 8:07 am
Viewing 15 posts - 7,696 through 7,710 (of 8,731 total)