Most efficient way to split string into rows

I am using the following function to split a string into rows. It is much faster than the previous function that I was using, however I need to somehow churn through this data quicker (its an ETL job): ALTER FUNCTION [dbo].[ArrayToTable] ( @InputString VARCHAR(MAX) = ” , @Delimitter VARCHAR(1) = ‘,’ ) RETURNS @RESULT TABLE([Position] […]

Create a database using T SQL on a specified location

How to create a database using T SQL script on a specified location? Let’s say, I want to create a SQL server database on D:\temp\dbFolder. How to do this?

Index a sum column

Is creating an index for a column that is being summed is faster than no index?

Sql Server 2014 – Update to windows 10 and can't connect to the Local Server

Recently I updated my Windows from 8 to 10 and suddenly my SQL Server 2014 stopped working. When I open the Management Studio and try to connect to the Server (local) i obtain the following error: Does any of you had similar problems? Before updating the Windows everything was running just fine.

T-SQL Insert or update

I have a question regarding performance of SQL Server. Suppose I have a table persons with the following columns: id, name, surname. Now, I want to insert a new row in this table. The rule is the following: If id is not present in the table, then insert the row. If id is present, then […]

CTE with recursion – row_number() aggregated

I have a table with a parent/child relationship along with a date created column referencing itself. I want to display each parent record and all the descendants ordered by the most recent ‘activity’ on the node. So if row number 1 which was created a long time ago has a new child added to it […]

T-SQL – changing datetime to date data type?

I have a column BirthDate in a table that is using the datetime data type. Currently, the values resemble the format 1987-12-30 00:00:00.000. I would like to update all the rows of this table, changing them to the following format with the date data type: 1987-12-30 I can run a SELECT… SELECT CONVERT(date, BirthDate) FROM […]

SQL Selecting rows at varying intervals

I’ve got a situation where I have a huge table, containing a huge number of rows, which looks like (for example): id Timestamp Value 14574499 2011-09-28 08:33:32.020 99713.3000 14574521 2011-09-28 08:33:42.203 99713.3000 14574540 2011-09-28 08:33:47.017 99713.3000 14574559 2011-09-28 08:38:53.177 99720.3100 14574578 2011-09-28 08:38:58.713 99720.3100 14574597 2011-09-28 08:39:03.590 99720.3100 14574616 2011-09-28 08:39:08.950 99720.3100 14574635 2011-09-28 08:39:13.793 […]

How do I determine if a column is an identity column in MSSQL 2000?

I want to do this in code, not with ALT+F1.

Passing an array/table to stored procedure through Entity Framework

I am using Entity Framework with C# to make a Silverlight application. I have written some stored procedures which perform database intensive operations and I need to call them from Entity Framework after passing some parameters. In one of the steps, the users select a list of items for which they would need more details. […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.