Top "Sql-server" questions

Microsoft SQL Server is a relational database management system (RDBMS).

Cannot truncate table because it is being referenced by a FOREIGN KEY constraint?

Using MSSQL2005, can I truncate a table with a foreign key constraint if I first truncate the child table (the …

sql-server sql-server-2005 tsql truncate foreign-keys
How to convert SQL Server's timestamp column to datetime format

As SQL Server returns timestamp like 'Nov 14 2011 03:12:12:947PM', is there some easy way to convert string to date format like …

sql-server datetime timestamp
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 …

sql sql-server database performance sql-server-2005
How to Execute SQL Server Stored Procedure in SQL Developer?

I've been given a user account to a SQL Server database that only has privileges to execute a stored procedure. …

sql-server stored-procedures oracle-sqldeveloper
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. …

sql sql-server sql-server-2005
Solutions for INSERT OR UPDATE on SQL Server

Assume a table structure of MyTable(KEY, datafield1, datafield2...). Often I want to either update an existing record, or insert …

sql sql-server database insert upsert
Add primary key to existing table

I have an existing table called Persion. In this table I have 5 columns: persionId Pname PMid Pdescription Pamt When I …

sql sql-server sql-server-2008 constraints primary-key
How do you change the datatype of a column in SQL Server?

I am trying to change a column from a varchar(50) to a nvarchar(200). What is the SQL command to alter …

sql-server tsql type-conversion alter-table
SQL Server SELECT LAST N Rows

This is a known question but the best solution I've found is something like: SELECT TOP N * FROM MyTable ORDER …

sql sql-server performance sql-server-2008
How to select date without time in SQL

When I select date in SQL it is returned as 2011-02-25 21:17:33.933. But I need only the Date part, that …

sql sql-server sql-server-2005