Viewing 15 posts - 76 through 90 (of 1,418 total)
As alter will work with a certificate in a single database, the way around this is to create a signed SP in db2 to truncate the table and then call...
March 8, 2024 at 2:09 pm
I have just managed to quickly look at this again. The problem is with the ALTER permission and TRUNCATE TABLE as it seems to work fine if the SP just...
March 8, 2024 at 10:51 am
While not clear, it seems as though you have a database in FULL recovery which has not had a log back in 3 or 4 years. The log file must...
March 6, 2024 at 3:59 pm
I would look at dynamic sql as well.
DECLARE @FilterId int = 4;
WITH CityTypes
AS
(
SELECT City, [State], CityType
FROM dbo.SampleData S
...
March 6, 2024 at 1:01 pm
-- Create a login with a strong password
CREATE LOGIN [NewUser] WITH PASSWORD = 'StR0nG_p@ssW0rd!';
I am not sure SQL Server authentication represents best practice but I suspect it...
March 1, 2024 at 1:39 pm
We had a cyber incident (sic) late last year and it was actually our ISP who picked up the problem. I doubt AI was involved as I think they found...
February 28, 2024 at 7:40 pm
we have Veeam which takes server backups.
If your databases are only being backed up to Veeam, I presume you are automating test restores from Veeam and running DBCC CHECKDB...
February 24, 2024 at 9:49 pm
SELECT n_type
,COUNT(1) AS Total
,SUM(IIF(d_type = 'a_type', 1, 0)) AS a_type
,SUM(IIF(d_type = 'b_type', 1, 0)) AS b_type
,SUM(IIF(d_type = 'x_type', 1, 0)) AS x_type
FROM @temp
GROUP BY n_type
ORDER BY n_type;
January 30, 2024 at 8:22 am
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
Viewing 15 posts - 76 through 90 (of 1,418 total)