Viewing 15 posts - 166 through 180 (of 1,497 total)
Ken's code is nice, but theoretically I believe it could yield a false positive if the previous month happened to be 13 months prior to the current month. For...
January 11, 2024 at 8:01 pm
WITH MonthCheck
AS
(
SELECT mainhost, enter_date
,IIF(MONTH(enter_date) - 1
...
January 11, 2024 at 10:11 am
Looking at this again the following is probably better:
WITH cte_Employee (EmployeeId, EmploymentTypeId, DateId)
AS
(
SELECT EmployeeId, EmploymentTypeId, DateId
FROM
...
January 9, 2024 at 5:13 pm
You would make your life easier if you stored dates as dates. This is an Islands and Gaps problem. One solution:
WITH cte_Employee (EmployeeId, EmploymentTypeId, DateId)
AS
(
...
January 9, 2024 at 3:51 pm
but I don't know how to replicate that in SQL.
Run Ed B's code.
In future, provide a test rig and test answers before answering. If you do not know how...
December 21, 2023 at 4:57 pm
I prefer migrations but have used in-place upgrades to buy time until there are the resources to look at a more managed upgrade. The trick is to have lots of...
December 20, 2023 at 10:28 am
I'll try to answer the questions all in one post here.
December 12, 2023 at 5:38 pm
@ken - The 2 views are in the same schema, but the underlying tables are in 2 different schemas. That said, if I run "SELECT * FROM ViewA" and...
December 12, 2023 at 9:13 am
Personally I will only use DENY permissions when I really have no option.
Are all the tables and views in the same schema or at least in schemas with the same...
December 11, 2023 at 8:39 pm
Your link uses the Microsoft OLE DB Driver for SQL Server not the ODBC driver. Maybe you should try that.
December 7, 2023 at 9:55 pm
The result still shows 23 instead of 00023 or 123 instead of 00123.
Where is the result showing 23? SSMS or, as I suspect, Excel etc
December 5, 2023 at 7:03 pm
My first replay seemed to time out so I posted again.
December 5, 2023 at 4:17 pm
I need to know how to add headers please
If this is an Agent Job step then Powershell is a lot less hassle. Play with something like:
$SQLparams...
December 5, 2023 at 4:13 pm
update #leadtest set [gamedate] = (select Lead([gamedate], 1) OVER( ORDER BY [gamedate] ASC))
LEAD is a windowed function - what makes you think it is going to work in a...
December 5, 2023 at 11:35 am
Viewing 15 posts - 166 through 180 (of 1,497 total)