How to sum up time field in SQL Server

I have a column called “WrkHrs” and the data type is time(hh:mm:ss). I want to sum up the working hours for employees. But since it’s time data type sql server doesn’t let me use like sum(columnname). How can I sum up the time data type fieled in sql query?

What is the command to truncate a SQL Server log file?

I need to empty an LDF file before sending to a colleague. How do I force SQL Server to truncate the log?

SQL Query to get latest price

I have a table containing prices for a lot of different “things” in a MS SQL 2005 table. There are hundreds of records per thing per day and the different things gets price updates at different times. ID uniqueidentifier not null, ThingID int NOT NULL, PriceDateTime datetime NOT NULL, Price decimal(18,4) NOT NULL I need […]

SQL Server Transaction Log Explorer/Analyzer

What options are available for rolling back transactions after the fact in SQL Server? I’m looking to have a plan in place before somebody deletes 10,000 of the wrong rows.

sql server: delete all the rows of all the tables

I’d like to clear the database altogether and reset the data. What’s the quickest way to do that? Or, what’s the command that will delete all the rows of a table (and I’ll repeat that process for all tables)? Thanks

No resultset if the store procedures does an update before the select on MSSQL server 2005

Does any one have any idea why I wont get a resultset if I do an update before the select in a store procedure. Im running MSSQL server 2005 and the latest Microsoft JDBC driver. Relevant java code: CallableStatement cstmt = con.prepareCall(“{call dbo.sp_groups_select}”); if (cstmt.execute()) { while (cstmt.getResultSet().next()) Does not get a resultset if the […]

SQL LocalDB vs SQL Server CE

I have a small project that will have 1 user on 1 computer. The database will be rather small (probably less than 1 mb of data). I plan to use WPF and Entity Framework for that project. I came up with 2 potential database solutions for my project : SQL Server CE and SQL Server […]

How to convert the system date format to dd/mm/yy in SQL Server 2008 R2?

I’m using SQL Server 2008 R2. I want to convert the system date to this format: dd/mm/yy “2013-01-01 00:00:00.000” to “Score Calculation – 10/01/13”. My column contains the data: 1. DMS01A13010101 2. RMS01A13010201 3. 44 4. 2013-01-01 00:00:00.000 What I want: if the record has 2013-01-01 00:00:00.000 in this format then only I change to […]

SQL Server, Python, and OS X

What’s a good way to interface Python running on OS X with a cloud-based SQL Server database? EDIT: With pyodbc I’m getting this error: >>> import pyodbc >>> cnxn = pyodbc.connect(‘DRIVER={SQL Server};;DATABASE=asdf;UID=asdf;PWD=asdf’) Traceback (most recent call last): File “<stdin>”, line 1, in <module> pyodbc.Error: (‘00000’, ‘[00000] [iODBC][Driver Manager]dlopen({SQL Server}, 6): image not found (0) (SQLDriverConnect)’)

The request failed or the service did not respond in a timely fashion?

I have the following error while I connect to SQL Server 2008 Management Studio with Windows authentication. “The request failed or the service did not respond in a timely fashion. Consult the event log or other applicable error logs for details.” Is anybody tell me why i am getting this error, whereas my SQL Server […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.