tagged [sql-server-2008]

COALESCE Function in TSQL

COALESCE Function in TSQL Can someone explain how the COALESCE function in TSQL works? The syntax is as follows > COALESCE(x, y) The MSDN document on this function is pretty vague

13 Nov at 18:25

How to create composite primary key in SQL Server 2008

How to create composite primary key in SQL Server 2008 I want to create tables in SQL Server 2008, but I don't know how to create composite primary key. How can I achieve this?

30 Jun at 18:24

Retrieve varbinary(MAX) from SQL Server to byte[] in C#

Retrieve varbinary(MAX) from SQL Server to byte[] in C# I'm trying to get a `varbinary(MAX)` from SQL Server to a `byte[]` variable in C#. How can I do this? Thanks

11 Oct at 10:49

SQL Query with NOT LIKE IN

SQL Query with NOT LIKE IN Please help me to write a sql query with the conditions as 'NOT LIKE IN' Getting error.

22 Feb at 10:55

how to show only even or odd rows in sql server 2008?

how to show only even or odd rows in sql server 2008? i have a table MEN in sql server 2008 that contain 150 rows. how i can show only the even or only the odd rows ?

12 Apr at 07:42

Modify table: How to change 'Allow Nulls' attribute from not null to allow null

Modify table: How to change 'Allow Nulls' attribute from not null to allow null How to change one attribute in a table using T-SQL to allow nulls (not null --> null)? Alter table maybe?

13 Feb at 15:20

How to wait for 2 seconds?

How to wait for 2 seconds? How does one cause a delay in execution for a specified number of seconds? This doesn't do it: What is the correct format?

25 Apr at 15:37

How do I move a table into a schema in T-SQL

How do I move a table into a schema in T-SQL I want to move a table into a specific Schema using T-SQL? I am using SQL Server 2008.

List rows after specific date

List rows after specific date I have a column in my database called "dob" of type datetime. How do I select all the rows after a specific DoB in SQL Server 2005?

How to backup Sql Database Programmatically in C#

How to backup Sql Database Programmatically in C# I want to write a code to backup my Sql Server 2008 Database using C# in .Net 4 FrameWork. Can anyone help in this.

Validate DateTime before inserting it into SQL Server database

Validate DateTime before inserting it into SQL Server database Is there any way to validate `datetime` field before inserting it into appropriate table? Trying to insert with try/catch block is not a ...

What are equivalent C# data types for SQL Server's date, time and datetimeoffset?

What are equivalent C# data types for SQL Server's date, time and datetimeoffset? What are the most suitable equivalent C# data types for the date datatypes in SQL Server? I'm specifically looking for...

6 May at 23:23

SSIS Dynamic Excel Destination File Name

SSIS Dynamic Excel Destination File Name How can I configure a dataflow task that takes data from a MS SQL Server 2008 datasource and puts it in an Excel file where the filename looks like 'date filen...

19 Jul at 18:58

What is the maximum characters for the NVARCHAR(MAX)?

What is the maximum characters for the NVARCHAR(MAX)? I have declared a column of type `NVARCHAR(MAX)` in SQL Server 2008, what would be its exact maximum characters having the MAX as the length?

Get Table and Index storage size in sql server

Get Table and Index storage size in sql server I want to get table data and index space for every table in my database: How can I achieve this result?

How to add hours to current date in SQL Server?

How to add hours to current date in SQL Server? I am trying to add hours to current time like How can I get hours ahead time in SQL Server?

29 Aug at 18:19

SQL Server 2008: How to query all databases sizes?

SQL Server 2008: How to query all databases sizes? I have MS SQL 2008 R2, 500 databases. What is the most efficient, easiest and 'modern' way to query all databases sizes. The output should have colum...

Credentials for the SQL Server Agent service are invalid

Credentials for the SQL Server Agent service are invalid I'm trying to install SQL Server 2008 development server on my local machine as administrator. During the installation I receive this error, an...

13 Aug at 11:22

3 Digit currency code to currency symbol

3 Digit currency code to currency symbol In C# is it possible to get a currency symbol, like '£', from the 3 character currency code, in this case 'GBP'? Is this possible either in SQL Server or in C#...

11 Sep at 16:15

Script to kill all connections to a database (More than RESTRICTED_USER ROLLBACK)

Script to kill all connections to a database (More than RESTRICTED_USER ROLLBACK) I have a development database that re-deploy frequently from a Visual Studio Database project (via a TFS Auto Build). ...

How to convert a SQL date to a DateTime?

How to convert a SQL date to a DateTime? I have a column with the `date` type in my SQL database. How can I convert it to C# `DateTime` and then back again to a SQL `date`?

sql server convert date to string MM/DD/YYYY

sql server convert date to string MM/DD/YYYY I am using SQL Server 2008. I have the following: How do I convert the date to string such that it show as MM/DD/YYYY

7 Aug at 22:5

What is datetime2?

What is datetime2? I´ve got this in a INSERT statment to MSSQL 2008 > System.Data.SqlClient.SqlException: The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range...

Remove trailing zeros from decimal in SQL Server

Remove trailing zeros from decimal in SQL Server I have a column `DECIMAL(9,6)` i.e. it supports values like 999,123456. But when I insert data like 123,4567 it becomes 123,456700 How to remove those ...

SQL-Date-Question: How to get Yesterdays date in the following formatte

SQL-Date-Question: How to get Yesterdays date in the following formatte Here is What I have So Far YIELDS What I need IS:

10 Mar at 18:49