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
I want to have the following query: SELECT COUNT(*) FROM MyTable WHERE CONTAINS (MyField, '(429)') The problem, is that the parenthesis are ignored and it is
I have created a view which uses dynamic variables in the where statement below. DECLARE @wkFileYear SMALLINT = (select fs.FileYear from dbo.FileSemesters fs
I need to do an Select on a table that has many records to mask the Account Number. Example AccNumber : 123400012341234 Output result should look like 1234000
I've got two foreign keys in a table. Let's assume that table is called News and has foreign keys updatedById and createdById, both of which point to userId in
For my unit tests I have an automated process which builds a copy of a DB, table by table. I first of all run a SELECT INTO and add the primary key and any indi