How to transpose this display. SeqNo Step Date By 1 Quoted 2018-03-01 Person1 2 Checked 2018-03-02 Person2 3 A
What SUM(IIF([CONDITION], 1, 0)) does is very simple. So simple, that what I really just want to write is COUNT([CONDITION]) (but that's invalid). Is there a sh
My goal is to create a stored procedure that generates new GUIDs using NEWSEQUENTIALID that can then be used when inserting data into a different table in the s
I have a table with hierarchical data: This is a sample of data with id, parent id, name, code (which is sometimes not filled), level and isroot column. In r
I'm working on my databases class final project, which consists of making an application that can access and do operations in a database. My t
I have two physical tables: notTempBaseLine with 50k records (index on Version, SrcDimension2_) notTempTrans with 400k records (index on BaseLineVersion, Dimens
I'm looking for a way to speed up the following process: I have a SSIS package that loads data from Excel files on a weekly basis to SQL Server. There are 3 fi
Consider a table where rows may be linked to each other. We need to select the rows that meet a certain requirement, OR where its linked row meets that requirem
I have an INSERT trigger on a view created with VIEW_METADATA. There's the following snippet: if @has_folder is null set @has_folder=(select REPLACE(REPLAC
I have a question to the TRUNCATE command. How does TRUNCATE work in background ? I read a text that says TRUNCATE creates a copy from the table and then star
I am counting 7-day active users using T-SQL. I used the following code: SELECT *, COUNT(DISTINCT [UserID]) OVER ( PARTITION BY [HospitalID],
CREATE PROCEDURE SPCheckDirectoryExists ( @chkdirectory as nvarchar(4000) ) AS SET NOCOUNT ON BEGIN DECLARE @folder_exists as int DECLA
I am using SQL Server 2008. I would like to give users possibility to copy files. Is it possible without using XP_CMDSHELL procedure? Cause i should not change
Here is my query: IF EXISTS(%some query%) BEGIN BEGIN TRY ALTER DATABASE [MyDatabase] SET single_user WITH ROLLBACK IMMEDIATE; --d
I've seen problems like these with users before, but never with a certificate. I have a simple certificate with no keys: CREATE CERTIFICATE [FOO_EXPORT] AUTHORI
I have to write a SQL Server query to display the employee last name and his respective manager’s name, as given below. John works for Robert Jane works f
I have a problem with this trigger. I would like it to update the requested information only to the row in question (the one I just updated) and not the entire
We are using tSQLt for unit testing our database and executed below: EXEC tSQLt.Run '[testComplianceDimensions].[test CountOfPropertiesWithLatestRepairJob]' EXE
Here i am new in Developing the SSIS package I need your support to come up with the solution. I have 10 different set of stored procedures which I have to ex
All, How can I check if a specified varchar character or entire string is upper case in T-Sql? Ideally I'd like to write a function to test if a character is u