Viewing 15 posts - 2,881 through 2,895 (of 10,143 total)
Koen Verbeeck (10/6/2014)
ChrisM@Work (10/6/2014)
Looks to me like an error in the query:...
Good catch.
And that's why we use the SQL formatting people 😀
+1
Our little team's working with DB2. If you think...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
October 6, 2014 at 4:06 am
Looks to me like an error in the query:
SELECT
A."CCUST" AS "CUSTOMER_NO",
A."CNME" AS "CUSTOMER_NM",
B."CTDESC" AS "CUSTOMER_GROUP_NM",
C."SNAME" AS "CUSTOMER_CAT15_DESC",
D."TMDESC" AS "TERMS DESCRIPTION",
E.CCCODE AS ZCC_CODE
FROM
ERPLXF."RCM" A
JOIN ERPLXF."RCT" B on B."CTCOMP"=A."CCOMP" AND...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
October 6, 2014 at 3:58 am
ZZartin (9/30/2014)
The basic idea would be something like,
CREATE TABLE #test_table (COL_ONE varchar(30), COL_TWO varchar(30), COL_THREE int)
...
-- Cursor version
DECLARE @sql varchar(max),
@col_three int
DECLARE temp_con CURSOR FOR SELECT DISTINCT COL_THREE FROM #test_table ORDER...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
October 3, 2014 at 9:12 am
;WITH SampleData AS (
SELECT * FROM (VALUES (1 ,0.11, 0),(2 ,0.45, 0.5),(3 ,0.85, 0.75)) d (id, A, B)
)
SELECT *, F = r3.A * ( 1 - r3.B * (...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
October 2, 2014 at 9:51 am
Igor Micev (10/1/2014)
CREATE FUNCTION dbo.fnGetMonthDays(@myDate DATE) RETURNS INT
AS
BEGIN
DECLARE @isLeap INT = 0
IF (YEAR(@myDate) % 400 = 0 OR (YEAR(@myDate) % 4 = 0 AND YEAR(@myDate) %...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
October 1, 2014 at 4:19 am
Mohit Dhiman (9/30/2014)
SELECT DATEADD(m,DATEDIFF(m,'19001231',GETDATE()),'19001231')This will give you the month end date for the current month (which can be changed by replacing GETDATE() with whichever other month-date you want)..
And you...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
October 1, 2014 at 4:12 am
taylor_benjamin (9/29/2014)
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
September 30, 2014 at 2:31 am
The "data length" of a row is more complex than simply counting the data characters. Columns have a minimum length, and many of the columns in your table have a...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
September 29, 2014 at 9:45 am
arrjay (9/29/2014)
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
September 29, 2014 at 5:40 am
Koen Verbeeck (9/29/2014)
What's the Point of Using VARCHAR(n)...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
September 29, 2014 at 5:17 am
Here is your DB2 query reformatted somewhat for clarity. The two subqueries in the WHERE clause are most likely to hit performance due to the non-SARGable predicates. If DB2 has...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
September 29, 2014 at 3:59 am
We're using OPENQUERY & linked server to run ad-hoc queries against a DB2 database. We discovered quite early on that DB2 (or possibly the driver) will balk at almost anything...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
September 29, 2014 at 2:09 am
If you're looking for a simple and reliable means of obtaining the last date of the current month, try this:
SELECT DATEADD(DAY,-1,DATEADD(MONTH,1+DATEDIFF(MONTH,0,GETDATE()),0))
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
September 29, 2014 at 2:03 am
Like this?
IF OBJECT_ID('tempdb..#iscr','U') IS NOT NULL DROP TABLE ##iscr
SELECT * INTO #iscr FROM _Iscritto WHERE 0 = 1
IF @cod_fondo = '2100'
BEGIN
INSERT INTO #iscr (<<column list>>)
SELECT <<column list>> FROM _Iscritto...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
September 26, 2014 at 9:49 am
Shouldn't you be setting FldNumeric23764 to different values here:
UPDATE C14 SET
[FldNumeric23764]= case
when tID = 1 and Q.n <= 100 then 2
when tID = 2 and Q.n <=...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
September 26, 2014 at 9:38 am
Viewing 15 posts - 2,881 through 2,895 (of 10,143 total)