tagged [sql-server]

How to use GROUP BY to concatenate strings in SQL Server?

How to use GROUP BY to concatenate strings in SQL Server? How do I get: to

How to get first character of a string in SQL?

How to get first character of a string in SQL? I have a SQL column with a length of 6. Now want to take only the first char of that column. Is there any string function in SQL to do this?

8 Aug at 14:32

How to format a numeric column as phone number in SQL

How to format a numeric column as phone number in SQL I have table in the database with a phone number column. The numbers look like this: I want to format that to look like this:

how to know status of currently running jobs

how to know status of currently running jobs I need to know if a given Job is currently running on Ms SQL 2008 server. So as to not to invoke same job again that may lead to concurrency issues.

Backup a single table with its data from a database in sql server 2008

Backup a single table with its data from a database in sql server 2008 I want to get a backup of a single table with its data from a database in SQL Server using a script. How can I do that?

9 Jun at 12:45

Import Excel spreadsheet columns into SQL Server database

Import Excel spreadsheet columns into SQL Server database I have an Excel spreadsheet that I want to import select columns into my SQL Server 2008 database table. The wizard didn't offer that option. ...

Rename column SQL Server 2008

Rename column SQL Server 2008 I am using SQL Server 2008 and Navicat. I need to rename a column in a table using SQL. This statement doesn't work.

How to delete large data of table in SQL without log?

How to delete large data of table in SQL without log? I have a large data table. There are 10 million records in this table. What is the best way for this query ``` Delete LargeTable where readTime

Insert Picture into SQL Server 2005 Image Field using only SQL

Insert Picture into SQL Server 2005 Image Field using only SQL Using SQL Server 2005 and Management Studio how do I insert a picture into an `Image` type column of a table? Most importantly how do I ...

15 Jun at 18:41

How to check which locks are held on a table

How to check which locks are held on a table How can we check which database locks are applied on which rows against a query batch? Any tool that highlights table row level locking in real time? DB: S...

How to set a default value for an existing column

How to set a default value for an existing column This isn't working in SQL Server 2008: The error is: > Incorrect syntax near the keyword 'SET'. What am I doing wrong?

How to create a table from select query result in SQL Server 2008

How to create a table from select query result in SQL Server 2008 I want to create a table from select query result in SQL Server, I tried but I got an error > Incorrect syntax near the keyword 'AS'

22 May at 05:5

Insert all values of a table into another table in SQL

Insert all values of a table into another table in SQL I am trying to insert all values of one table into another. But the insert statement accepts values, but i would like it to accept a select * fro...

23 Feb at 03:27

How to save select query results within temporary table?

How to save select query results within temporary table? I need to save select query output into temporary table. Then I need to make another select query against this temporary table. Does anybody kn...

8 Dec at 20:25

How do you specify a different port number in SQL Management Studio?

How do you specify a different port number in SQL Management Studio? I am trying to connect to a Microsoft SQL 2005 server which is not on port 1433. How do I indicate a different port number when con...

22 Dec at 09:0

What to keep in mind while migrating SSIS packages from SQL Server 2005 to 2008?

What to keep in mind while migrating SSIS packages from SQL Server 2005 to 2008? What are best practices for moving/exporting SQL Server Integration Services Packages from a SQL Server 2005 DB over to...

Generate MD5 hash string with T-SQL

Generate MD5 hash string with T-SQL Is there a way to generate MD5 Hash string of type varchar(32) without using fn_varbintohexstr So it could be used inside a view with SCHEMABINDING

19 Aug at 20:47

Split function equivalent in T-SQL?

Split function equivalent in T-SQL? I’m looking to split '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15...' (comma delimited) into a table or table variable. Does anyone have a function that returns each one i...

30 Jan at 15:39

Compare DATETIME and DATE ignoring time portion

Compare DATETIME and DATE ignoring time portion I have two tables where column `[date]` is type of `DATETIME2(0)`. I have to compare two records only by theirs Date parts (day+month+year), discarding ...

SQL query for getting data for last 3 months

SQL query for getting data for last 3 months How can you get today's date and convert it to `01/mm /yyyy` format and get data from the table with delivery month 3 months ago? Table already contains de...

How to change a table name using an SQL query?

How to change a table name using an SQL query? How can I in change the table name using a query statement? I used the following syntax but I couldn't find the rename keyword in SQL server 2005.

24 Jan at 10:6

Resolve hostnames with t-sql

Resolve hostnames with t-sql How can i resolve a hostname in t-sql? a 2000 compatible method is preferred. Although something that works on 2005/2008 would also be helpful. eg. If i have the hostname...

9 Jun at 00:39

SQL Server Profiler - How to filter trace to only display events from one database?

SQL Server Profiler - How to filter trace to only display events from one database? How do I limit a SQL Server Profiler trace to a specific database? I can't see how to filter the trace to not see ev...

SQL Query to add a new column after an existing column in SQL Server 2005

SQL Query to add a new column after an existing column in SQL Server 2005 I need a SQL query which add a new column after an existing column, so the column will be added in a specific order. Please su...

25 Jul at 13:17

Difference between Implicit and Explicit Transaction

Difference between Implicit and Explicit Transaction What is the difference between Implicit and Explicit transaction in Sql Server 2008? What happens in TransactionScope background? I'm using Transac...