Viewing 15 posts - 766 through 780 (of 2,645 total)
;with cte as
(
select N
from (values (1000),(10001),(100002),(1000003),(1000004),(100000005),(1000000006)) T(N)
)
SELECT N,D+(N-(D+E+F)) D,E,F
from cte
cross apply(values (0.986 * N , 0.012*N,...
December 7, 2021 at 7:41 pm
You cannot include DECLARE inside a SQL statement.
Your SQL should look more like this:
DECLARE @keysValueToSearch NVARCHAR(4000) = 'from'
DECLARE @untilThisCharAppears NVARCHAR(4000) = 'where'
DECLARE @keysValueToSearchPattern NVARCHAR(4000) = '%' +...
December 6, 2021 at 7:43 pm
If you install this function: https://www.sqlservercentral.com/scripts/a-daterange-table-valued-function
You can then run this code:
;WITH CTE as
(
SELECT *
FROM...
December 6, 2021 at 6:02 pm
I saw that and was totally impressed. It only took them 5 years to get a fix out... kind of. As you say, it's only in Azure so far....
November 17, 2021 at 7:05 pm
SQL Server now, at last, has added an addition (enable_ordinal) parameter to the STRING_SPLIT function.
This returns a column called ordinal the same value as the ItemNumber column in DelimitedSplit8K
November 17, 2021 at 5:49 pm
Just one more question...
If there are no values, thus no sums in the Pivot Query below, is there a way to have it return zero's?
SELECT pt.[imtPartID],...
November 10, 2021 at 7:09 pm
Does an estimated execution plan find any missing indexes?
To speed the query up you could try putting an index on the Customer table with the leading edge on columns Customer,...
November 5, 2021 at 4:53 pm
For this type of design it is normal practice to have a table to join on that relates the 3-character code to the Comments table.
e.g:
CREATE TABLE a3ltrcodeTBL_Comments
(
...
November 5, 2021 at 3:44 pm
From what you say maybe you could join the tables with a wildcard?:
SELECT a.3ltrcode,
b.CommentCode
FROM 3ltrcodeTBL a
INNER...
November 5, 2021 at 2:46 pm
I think this is the equivalent of your original statement.
CREATE PROCEDURE [dbo].[Sel_Transf_Ext_Hist]
(
@Customer INT,
@Session INT = 0
)
AS
SELECT DISTINCT
...
November 5, 2021 at 2:41 pm
Can you explain what you are trying to do with the query?
You cannot return two values fin the THEN and you also cannot OR two strings together ( THEN 'Midwest'...
November 5, 2021 at 1:46 pm
I don't understand what you are trying to do or your data. But I think the part:
Bank = (Select Bank From Customer Where Customer=t.Customer)
is redundant.
I think this...
November 4, 2021 at 10:56 pm
select 'Midwest' OR 'Mid-Atlantic'
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'OR'.
Completion time: 2021-11-04T21:11:04.2830349+00:00
November 4, 2021 at 9:11 pm
IF OBJECT_ID('tempdb..#PartTransactions','U') IS NOT NULL
DROP TABLE #PartTransactions
GO
SELECT *
INTO #PartTransactions
FROM (VALUES ('2020-12-31 19:00:09',3,7000917),
('2020-09-29 12:05:25',1,7000917),
...
November 3, 2021 at 7:41 pm
the 'x' was just there so it's included in the count. You could put anything that's not null.
This is also the equivalent:
SELECT pt.[imtPartID],
...
November 3, 2021 at 5:52 pm
Viewing 15 posts - 766 through 780 (of 2,645 total)