Viewing 15 posts - 1 through 15 (of 211 total)
One thing I noticed is that you're not setting @TableHead to anything. So you're concatenating string variables where one of them is NULL:
NULL + 'SomeString' = NULL
_____________________________________________________________________
- Nate
September 9, 2016 at 1:15 pm
Going back to your original statement, if both columns are NOT NULL and CONVERTed to strings then you should be able to concatenate them.
USE tempdb;
DECLARE @tmp TABLE (Date1 DATETIME, Date2...
_____________________________________________________________________
- Nate
August 30, 2016 at 11:13 am
when t1.[PROCEDURE] <> t2.CATEGORY and CAST(T1.[Delivery Date] AS DATE) = CAST(T2.[TIME] AS DATE)
then CAST(T1.entrytime AS VARCHAR)+' -&- ' +CAST(T2.[TIME] AS VARCHAR)
Looks like you're comparing T1.[Delivery Date] to T2.[TIME] in the...
_____________________________________________________________________
- Nate
August 30, 2016 at 10:00 am
Sounds like PIVOT is what you're looking for
TechNet link: Using PIVOT and UNPIVOT
_____________________________________________________________________
- Nate
May 5, 2016 at 2:31 pm
OK, threw enough crap at the wall I finally got something to stick: drop and recreate linked server using SQLNCLI11 driver instead of SQLNCLI10.
However, would still like to know why...
_____________________________________________________________________
- Nate
February 16, 2016 at 2:00 pm
OK, it works if I wrap it in a distributed transaction. Is there something new to 2012 I'm missing that would let me configure this?
This works:
BEGIN DISTRIBUTED TRAN;
SELECT SomeColumn
FROM ...
_____________________________________________________________________
- Nate
February 16, 2016 at 9:54 am
daniel.hughes 66721 (2/16/2016)
Permissions still active on the sqlJDBCXAUser role?
That role didn't/doesn't exist since XA transactions aren't enabled on either server. Is this something that needs to enabled in 2012 which...
_____________________________________________________________________
- Nate
February 16, 2016 at 9:32 am
You might try reworking/tuning your DELETE statement.
Decent article on NOT IN alternatives: Should I use NOT IN, OUTER APPLY, LEFT OUTER JOIN, EXCEPT, or NOT EXISTS?
YMMV but I'd also...
_____________________________________________________________________
- Nate
September 2, 2015 at 9:27 am
Using Jun 1 and Jun 8 as your dates, DATEDIFF would meet 7 day criteria but includes weekends. Something like this might work?
DECLARE @StartDate DATE = '20150601'
,@EndDate DATE = '20150608'
SELECT...
_____________________________________________________________________
- Nate
June 16, 2015 at 1:17 pm
This is more dynamic (and includes run time). Depending on your requirements, you might consider changing to use outer joins on sysjobhistory subqueries to catch any jobs which haven't processed...
_____________________________________________________________________
- Nate
June 11, 2015 at 3:05 pm
Couldn't find a great link but I've heard it referred to as "chained CTEs" before
;With mstrTable(ItemNo, Sales)
as (
Query1
Union All
Query2
)
, mstrTable_2 (RowNo, ItemNo, Sales )
AS (
Select Row_Number () Over(Partition by ItemNo...
_____________________________________________________________________
- Nate
June 9, 2015 at 9:50 am
Drop and recreate the UDF?
Worked out an example that I believe mimics your scenario...would appear that the columns that satisfy * get "saved" to sys.columns when UDF created.
USE tempdb;
CREATE TABLE...
_____________________________________________________________________
- Nate
May 13, 2015 at 2:41 pm
Fair enough but it did get me past my mental block. Plus I still have to implement it then go through unit and load testing before I'd ever release it...
_____________________________________________________________________
- Nate
March 10, 2014 at 5:49 pm
Thanks Luis! That seems to solve my issue!
_____________________________________________________________________
- Nate
March 10, 2014 at 1:43 pm
Thanks for responding Keith and sorry I failed to include the DELETE case. My test scripts are evidently no better than my MERGE statements today.
The code (now w/ SomeBId 2...
_____________________________________________________________________
- Nate
March 10, 2014 at 12:20 pm
Viewing 15 posts - 1 through 15 (of 211 total)