tagged [sql-server]

Create SQL Server CE database file programmatically

Create SQL Server CE database file programmatically How can I create a new SQL Server Compact database file (.sdf) programmatically, without having an existing template file to copy from?

GRANT EXECUTE to all stored procedures

GRANT EXECUTE to all stored procedures Does the following command effectively give the user, "MyUser," permission to execute ALL stored procedures in the database?

Get Hours and Minutes (HH:MM) from date

Get Hours and Minutes (HH:MM) from date I want to get only `hh:mm` from date. How I can get this? I have tried this :

20 Jun at 15:21

Datetime in where clause

Datetime in where clause How can I select 12/20/2008 in `where` clause of sql? The server is SQL server 2005.

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

Drop primary key using script in SQL Server database

Drop primary key using script in SQL Server database I need to drop the primary key of a table `Student` in a SQL Server database. I have edited in the table and the script I got is But when I run thi...

How can I do a BEFORE UPDATED trigger with sql server?

How can I do a BEFORE UPDATED trigger with sql server? I'm using Sqlserver express and I can't do `before updated` trigger. There's a other way to do that?

SQL query to group by day

SQL query to group by day I want to list all sales, and group the sum by day. NOTE: I am using SQL Server 2005.

SQL Server: Filter output of sp_who2

SQL Server: Filter output of sp_who2 Under SQL Server, is there an easy way to filter the output of sp_who2? Say I wanted to just show rows for a certain database, for example.

15 Jun at 02:22

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

is not a recognized built-in function name

is not a recognized built-in function name Created a function When

How to use the divide function in the query?

How to use the divide function in the query? I want to show the percentage for the Overshipment column. My sample query Table Name - CSPGI09_OVERSHIPMENT My formula: ``` ------------------------------...

Using Stored Procedure into Select (T-SQL)

Using Stored Procedure into Select (T-SQL) I need to access the result of a stored procedure within a select statement, i.e.: in SQL_Server 2005.

Slow (to none) performance on SQL 2005 after attaching SQL 2000 database

Slow (to none) performance on SQL 2005 after attaching SQL 2000 database Issue: Using the detach/attach SQL database from a SQL 2000 SP4 instance to a much beefier SQL 2005 SP2 server. Run reindex, re...

T-SQL Substring - Last 3 Characters

T-SQL Substring - Last 3 Characters Using T-SQL, how would I go about getting the characters of a varchar column? So the column text is `IDS_ENUM_Change_262147_190` and I need `190`

30 Nov at 21:10

SQL Query to find the last day of the month

SQL Query to find the last day of the month I need to find the last day of a month in the following format: Anybody please help out.

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 get number of rows inserted by a transaction

How to get number of rows inserted by a transaction I have to manage a log where i have to see the number of rows that are inserted by a transaction. Is there any way of doing it dynamically ?

16 Feb at 12:11

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?

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

How to get the first and last date of the current year?

How to get the first and last date of the current year? Using SQL Server 2000, how can I get the first and last date of the current year? Expected Output: `01/01/2012` and `31/12/2012`

2 Jan at 16:45

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