Viewing 15 posts - 46 through 60 (of 670 total)
With DDL and sample data, I can only guess at using row_number over/partition clause
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
January 13, 2021 at 7:19 pm
That's how I would do it. Use a tally table or table function to generate the values needed, then left join the tally table to your dataset , then us...
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
January 12, 2021 at 4:13 pm
What is the PK of the Insurance Table? Include that in your cursor, then update the MsgSent to 1 after the send email proc call
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
January 11, 2021 at 5:13 pm
I created DDL based on your sample. You hardcoded the orderid in your union all statement. Can you provide usable DDL and data to help show what you are looking...
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
January 11, 2021 at 3:27 pm
Looks like Min/Max works for your scenario
IF OBJECT_ID('tempdb..#Codes') IS NOT NULL
DROP TABLE #Codes
Create table #Codes (
Code_Type varchar(20),
Start_Id int,
End_Id int)
insert into #Codes values
('all_codes_set',1,5 ),
('all_codes_set',7,14 ),
('all_codes_set',17,49 ),
('all_codes_set',61,100),
('voided',6,6),
('cancelled',50,60),
('unused',15,16)
Select Code_type, min(Start_Id)...For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
January 11, 2021 at 1:51 pm
You have to do some outer applies.
declare @x xml
SELECT @x = CAST(MY_XML AS xml)
FROM OPENROWSET(BULK 'C:\Users\MyUser\Documents\Lukasz\Apps\Ramo\SIN\SecutrityUsers.xml', SINGLE_BLOB) AS T(MY_XML)
...
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
January 8, 2021 at 1:32 pm
removed - duplicate from above
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
January 5, 2021 at 8:35 pm
always start in lower environments (Dev, Test, Stage, Prod) or something similar. The Environments should be relatively the same. There may be different code in different environments depending on where...
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
December 18, 2020 at 4:37 pm
You can do merge to #L in the proc and output the insert/deleted values to a temp table, then use the temp table to merge values to #P table
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
December 18, 2020 at 4:34 pm
Select t.column1, (SELECT STUFF(
...
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
December 18, 2020 at 4:29 pm
how do you know the order of the values to concatenate? You can use Stuff to accomplish this, but you'll need a way to know which ones to include. (i.e....
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
December 18, 2020 at 2:38 pm
Something like this?
select CustomerID, Create_Date,
(select count(1)
from #Customers c1
where c1.Create_date between DateAdd(hour, -1, c.Create_date) and c.Create_date) as NumberOfSignups
--,Count(1)
from #Customers c
where c.Create_date between DateAdd(hour, -1, c.Create_date) and c.Create_date
order by...
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
December 17, 2020 at 8:59 pm
SELECT s.[BusinessEntityID] ,
s.[Name] ,
at.[Name] AS [AddressType],
A.AddressID,
a.[AddressLine1] ,
a.[AddressLine2] ,
a.[City] ,
sp.[Name] AS [StateProvinceName] ,
a.[PostalCode] ,
cr.[Name] AS [CountryRegionName]
FROM [Sales].[Store] S Join [Person].[BusinessEntityAddress] BEA ON bea.[BusinessEntityID] = s.[BusinessEntityID]
Join [Person].[Address] a ON...
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
December 15, 2020 at 8:25 pm
Check the data source task. Right Click --> Open Advanced Editor. On Input/Output tab open External Columns and Output Columns. Find your column and see what the...
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
December 4, 2020 at 8:19 pm
Wow, Joe!!! Condescending much??
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
December 2, 2020 at 8:39 pm
Viewing 15 posts - 46 through 60 (of 670 total)