for each in MS SQL SERVER?

I have two tables: Employees(EmployeeID, EmployeeName, EmployeeStatus, BasicSalary) and EmployeePayroll (PayrollID, EmployeeID, VoucherNo, BasicSalary, SalaryMonth) I want to make a for each loop for every employee in the first table so that I can insert dummy data like (0, EmployeeID,0 ,0 ,0) into the second table. I tried to make it with a for loop […]

How can I auto-increment a column without using IDENTITY?

I’m creating a table with two columns that I want to auto-increment. One column is a primary key, so I’m using the IDENTITY keyword on it. The other column will be used to track the user-defined “sort order” of items in the table. Any time the user moves an item, its “sort order” will swap […]

SQL Server 2008: Getting deadlocks… without any locks

I’m currently conducting some experiments on a SQL Server 2008 database. More specifically, I have a JDBC application that uses hundreds of concurrent threads to execute thousands of tasks, each of which runs the following query on the database: UPDATE from Table A where rowID=’123′ However, I’m getting a ton of deadlock errors (SQL Exception […]

In what format is SQL Server data serialized when it is sent through the network?

The reason I am asking this question is because we are planning to read A LOT (several GB’s) of data from a SQL Server database to a .Net app for processing. I would like to know how much space overhead to calculate for each record for estimating the impact on our network traffic. E.g. a […]


I am shocked. I spent past 3-4 days figuring out how I could implement stemming (and synonyms searches) in mysql when I see in SQL Server the query is incredibly easly: Select * from tab where CONTAINS(*,’FORMSOF(THESAURUS,word)’) Is possibile on MySql there isn’t anything like that?

Get consecutive numbers Range from SQL Server Table

I am using SQL Server 2014. I have a Table having Column BookNo as datatype int. This column contains below data |BookNo| 1 2 3 4 5 10 12 13 25 26 27 28 I want to the Consecutive Numbers Range in Sql query. From above data my output should be like 1 to 5 […]

INSERT INTO SET syntax in SQL Server

I come from mySQL to SQL Server. Doesn’t the following syntax work in SQL Server? INSERT INTO table SET fil1=”234″, fil2=”324″ Is there an comparable statement in SQL Server?

edge-sql.js how to set connectionString?

var edge = require(‘edge’); var getProduct = edge.func(‘sql’, function () {/* select * from Products where ProductId = @myProductId */}); getProduct({ myProductId: 10 }, function (error, result) { if (error) throw error; console.log(result); }); This Code works well but I feel uncomfortable with setting the ConnectionString as ENVIROMENT_VARIALBE! set EDGE_SQL_CONNECTION_STRING=Data Source=localhost;Initial Catalog=Northwind;Integrated Security=True But I […]

Read Schema Name, Table Name and Column Name From a SQL DB and return to C# Code

I have a DB (in SQL Server 2008 SP3) and need all Schema names, Table names and Column Names in related hierarchy in C# Code, I have the SQLElement Class as Following: public class SQLElement { public string SchemaName { get; set; } public string TableName { get; set; } public string ColumnName { get; […]

T-SQL: How do I get the rows from one table whose values completely match up with values in another table?

Given the following: declare @a table ( pkid int, value int ) declare @b table ( otherID int, value int ) insert into @a values (1, 1000) insert into @a values (1, 1001) insert into @a values (2, 1000) insert into @a values (2, 1001) insert into @a values (2, 1002) insert into @b values […]

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