tagged [sql-server-2005]

how to insert datetime into the SQL Database table?

how to insert datetime into the SQL Database table? How can I insert datetime into the SQL Database table ? Is there a way to insert this query through the insert command in C# / .NET?

Restore database backup over the network

Restore database backup over the network How do you restore a database backup using SQL Server 2005 over the network? I recall doing this before but there was something odd about the way you had to do...

How to use colors in SQL Server 2008?

How to use colors in SQL Server 2008? I have one `SELECT` statement which returns me for example 10 rows. Out of these 10 rows, I want to mark 5 rows in red color. Is this possible with SQL Server 200...

16 Jan at 16:6

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:

Dynamic SELECT TOP @var In SQL Server

Dynamic SELECT TOP @var In SQL Server How can I have a dynamic variable setting the amount of rows to return in SQL Server? Below is not valid syntax in SQL Server 2005+:

26 Jan at 23:41

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...

What is the equivalent datatype of SQL Server's Numeric in C#

What is the equivalent datatype of SQL Server's Numeric in C# In SQL Server we can write data AS `Numeric(15,10)` .. what will the equivalent of this in C#? I know that `Numeric`'s equivalent is `Deci...

21 Jul at 07:6

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...

Querying data by joining two tables in two database on different servers

Querying data by joining two tables in two database on different servers There are two tables in two different databases on different servers, I need to join them so as to make few queries. What optio...

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

How to split a string in T-SQL?

How to split a string in T-SQL? I have a `varchar @a='a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p'`, which has `|` delimited values. I want to split this variable in a array or a table. How can I do this?

8 Aug at 16:43

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...

Way to insert text having ' (apostrophe) into a SQL table

Way to insert text having ' (apostrophe) into a SQL table While I was trying the following SQL command , I got sql error. where doesn't contain the apostrophe. What is the way to insert text having ' ...

1 Dec at 05:11

What does Trusted = yes/no mean in Sql connection string?

What does Trusted = yes/no mean in Sql connection string? What does Trusted = yes/no mean in Sql connection string? I am creating a connection string as below : Please Help

7 Aug at 05:11

How to insert a blob into a database using sql server management studio

How to insert a blob into a database using sql server management studio How can I easily insert a blob into a `varbinary(MAX)` field? As an example: thing I want to insert is: c:\picture.png the table...

19 Mar at 22:20

MultipleActiveResultSets=True or multiple connections?

MultipleActiveResultSets=True or multiple connections? I have some C# in which I create a reader on a connection (`ExecuteReader`), then for every row in that reader, perform another command (with `Ex...

Are there any disadvantages to always using nvarchar(MAX)?

Are there any disadvantages to always using nvarchar(MAX)? In SQL Server 2005, are there any disadvantages to making all character fields nvarchar(MAX) rather than specifying a length explicitly, e.g....

3 Feb at 13:5

Convert Month Number to Month Name Function in SQL

Convert Month Number to Month Name Function in SQL I have months stored in SQL Server as 1,2,3,4,...12. I would like to display them as January,February etc. Is there a function in SQL Server like Mon...

23 May at 14:9