Here's a few of the new posts today on the forums. To see more, visit the forums. |
SQL Server 2017 - Development |
Backup a line of a table if a row is updated - Hi there! I have an SQL table called ORIGIN with 5 fields. Each time one of the field in changing, I would like this line to be copied to another table called BACKUP. What i am trying to achieve is to have a simple way to do backup that is accessible to the end user. […] |
SQL Server 2016 - Administration |
SQL Reports a Checksum error but the expected and actual are the same - Is SQL reporting a false positive.. I see where the expected checksum is the same as the actual. 12/15/2021 12:05:00 PM -> Step 1 [Run agent.]: Executed as user: GLOBAL\s-any-sql-sc. Removed 8 replicated transactions consisting of 1379637 statements in 525 seconds (2627 rows/sec). [SQLSTATE 01000] (Message 21010) The operating system returned error incorrect checksum (expected: […] |
TDE Encryption - I have one DB in of my dev server which should be encrypted like any other DBs on that server. So when I run this command, I see the status 'ENCRYPTED" SELECT DB_NAME(database_id) AS DatabaseName, encryption_state, encryption_state_desc = CASE encryption_state WHEN '0' THEN 'No database encryption key present, no encryption' WHEN '1' THEN 'Unencrypted' WHEN […] |
SQL Server 2016 - Development and T-SQL |
SSIS Pkg being executed twice at the same time under different service accounts - Hello, I have a SQL Job that runs daily at 11pm. Recently we have noticed that pkgs being executed in a job step are being executed twice with a start time almost the same. The pkg All Execution history shows that each run was under a different service acct. I've used RedGate SQL Search and […] |
Development - SQL Server 2014 |
IsNull Statement - Hi How the below statement works - AND Table1.ID2 = ISNULL(@Parameter3, Table1.ID2) Thanks |
if condition not working - Hi I have given only date parameters . All other null , but it is not going in If condition -- ============================================= Alter PROCEDURE [dbo].[Ind_sp_CabProfitability] @frDate date, @toDate date, @VCode nvarchar(15) = null, @VName nvarchar(100) = null, @CCode nvarchar(15) = null, @CName nvarchar(100) = null, @CGroup nvarchar(15) = null as begin If @VCode is Null […] |
Multiple Parameters - Hi How to convert below code like - CREATE PROCEDURE [dbo].[GetData] ( @Parameter1 varchar(256), @Parameter2 varchar(256), @Parameter3 int = null ) AS BEGIN SET NOCOUNT ON; DECLARE @BaseQuery nvarchar(max) = N'SELECT T.* FROM dbo.Table1 AS T' , @ParamList nvarchar(max) = N'@p1 varchar(256), @p2 varchar(256), @p3 int' , @WhereClause nvarchar(max) = ' WHERE 1=1'; IF @Parameter1 […] |
where clause - Hi I have below parameters . @frDate date, @toDate date, @VName nvarchar(100) = null, @CName nvarchar(100) = null, I want if user has entered nothing in VName and Cname then where should be between @frDate and @ Todate If user has entered Vname & Dates then all records with date range and Vname = @ […] |
Case Statement in where - Hi Is it possible to do like this @ItemGroup is a parameter Select Itemcode,Itemname,ItemGroup from tbl1 Case when @ItemGroup is null then where itemgroup is null else where itemgroup is not null end Thanks |
case statement - Hi In below line i want if when > 0 instead of 0 then what should i change (Select Case (select count(*) from tbl1 T where T.num = T0.num ) when 0 then Thanks |
Invalid column Name Hcode - Hi (Select Case (select count(*) from tbl1 T where T.num = T0.num ) when 0 then HCode=STUFF ( ( SELECT ', '+ CAST(A0.[aCode] AS VARCHAR(MAX)) FROM O A0 INNER JOIN I A1 ON A0.[AEntry] = A1.[SEntry] FOR XMl PATH('') ),1,1,'' ) else '2' end) from tbl5 t0 Thanks |
SQL Server 2012 - T-SQL |
Grouping by hour and minute from TimeStamped data - TSQL is not my daily language and I could use a hand figutring this one out. I have date that I'd like to report on that shows the number of processes that start every 10 minutes for a given day of the week. The data consists of 6 years worth. I'd like to pull reports […] |
SQL Server 2019 - Administration |
Applying SQL Server 2019 CU 14 cause's master database corruption - I've just recently applied the SQL Server 2019 CU14 to two of our testing servers with no problem. Then when applying this CU to our staging environment the install failed and left me with a corrupted Master Database which meant the SQL Server Service wouldn't start and luckily I had a Master database backup to […] |
SQL Server 2019 - Development |
Slow Query On SQL 2019 - Hi all, I have a problem with this query: SELECT top 10 (total_elapsed_time/execution_count)/1000 AS 'AVGEXETIME', 'AverageIO' = (total_logical_reads + total_logical_writes) / qs.execution_count, 'TotalIO' = (total_logical_reads + total_logical_writes), 'Executioncount' = qs.execution_count, 'IndividualQuery' = SUBSTRING (qt.text,(qs.statement_start_offset/2)+1, ((CASE WHEN qs.statement_end_offset = -1 THEN LEN(CONVERT(NVARCHAR(MAX), qt.text)) * 2 ELSE qs.statement_end_offset END - qs.statement_start_offset)/2)+1) ,'ParentQuery' = qt.text,'DatabaseName' = COALESCE(DB_NAME(qt.dbid),DB_NAME(CAST(pa.value […] |
SSRS 2012 |
SSRS reports - Hi All, I need to delete multiple SSRS reports from report portal. Is there any way to delete them using either rs.exe or any other utilites you might know of? Thank you |