Viewing 15 posts - 826 through 840 (of 2,648 total)
Install the DateRange table valued function here: https://www.sqlservercentral.com/scripts/a-daterange-table-valued-function
IF OBJECT_ID('[dbo].[DateRange]','IF') IS NULL BEGIN
PRINT 'CREATE FUNCTION [dbo].[DateRange]'
EXEC ('CREATE FUNCTION... September 22, 2021 at 12:17 am
I've got just the table valued function you need:
IF OBJECT_ID('[dbo].[DateRange]','IF') IS NULL BEGIN
PRINT 'CREATE FUNCTION [dbo].[DateRange]'
EXEC ('CREATE FUNCTION... September 12, 2021 at 6:07 pm
This returns the results you have given:
declare @month1 datetime = '2021-08-01 00:00:00.000',
@month2 datetime = '2021-09-01 00:00:00.000'
select e.HierMonth, e.empID,empName,'new addition',mgrID
...
September 8, 2021 at 11:17 am
depending on number of columns on that table you may need (and it may be advisable) to resort to have a hash column added and make this...
September 7, 2021 at 4:14 pm
depending on number of columns on that table you may need (and it may be advisable) to resort to have a hash column added and make this column the...
September 7, 2021 at 12:41 pm
WITH SampleData2 (PERSONNUM, [ORGPATHTXT]) AS
(
SELECT 231089,'./Company/20-00001/120---30-00006/40-00506/50-99506/60-29145/97455001/0097455001/Fire-Grill'
UNION ALL
SELECT 121564,'./Company/20-00001/120---30-00006/40-00073/50-00075/60-26275/68990001/0068990001/Location3/Burger-Cook'
UNION...
August 31, 2021 at 7:24 pm
If you think it will be faster using a seek then just force the query to do a seek and see if it's faster
select ol.ord_no, pl.ID
...
August 25, 2021 at 6:04 pm
I generally never put error handling into a stored procedure unless I want to take some specific action inside the stored procedure for that error. If an error is raised...
August 23, 2021 at 4:01 pm
There are some caveats to that should've been mentioned. The string is declared as NVARCHAR(MAX) because I don't know that that's not appropriate. The ordinal splitter is name...
August 11, 2021 at 4:07 pm
August 2, 2021 at 11:14 am
Here's a way, though it would be pretty stupid to do it.
SELECT x.CustomerID
FROM (SELECT c.CustomerID, 0 Col1
...
July 29, 2021 at 11:27 pm
Maybe they meant using a set operator. In which case you would use EXCEPT not UNION.
SELECT c.CustomerID
FROM [Customers] c
EXCEPT
SELECT o.CustomerID
FROM [Orders]...
July 29, 2021 at 11:23 pm
The single query method did not work, even after changing s2.Value to s2.ColName in the necessary spots.
Yes, I see why now, the join on the update query returns more...
July 28, 2021 at 4:05 pm
Other than using dynamic SQL I think you will have to do it like this:
In 2 statements
UPDATE s
SET s.Col1 = s2.Value
FROM #sample...
July 28, 2021 at 3:42 pm
I don't understand how adding a column can add rows.
Can you show us the code?
July 12, 2021 at 4:09 pm
Viewing 15 posts - 826 through 840 (of 2,648 total)