Wednesday, April 24, 2013

[SQL Server] Error 5 when trying to connect to database

[SQL Server] Error 5 when trying to connect to database


Error 5 when trying to connect to database

Posted: 24 Apr 2013 07:30 AM PDT

I am trying to connect to SQL Server 2008 R2 Express from Visual Studio 2012. When executing the VS code it returns the following error:[SqlException (0x80131904): Directory lookup for the file "c:\users\austens samsung\documents\visual studio 2012\Projects\learning1\learning1\App_Data\test.mdf" failed with the operating system error 5(Access is denied.).CREATE DATABASE failed. Some file names listed could not be created. Check related errors.]Do I need to be running VS as administrator? My server is up and running and connected? The code is trying to create the database test. Any help would be appreciated.

"Total Revenue Per Day" SQL Query Format

Posted: 24 Apr 2013 05:01 AM PDT

I have a table called DollarTransactions in a database, which records purchases. The table has the following fields, which you can see by clicking the link to a screenshot: [IMG]http://i33.tinypic.com/vs2byd.jpg[/IMG]I need to write 3 queries using these fields: 1) Total Cents for each day in the month of March 2013. Revenue is measured with the "cents" field. 2) Total Cents per hour for each day in March 20133) User ID of the user who spent the most Cents in December 2012? I was working on a query for #1 that went like this: [code]SELECT trunc(createdDate, 'HH') "Hour", sum(cents)FROM DollarTransactionsWHERE createdDate BETWEEN '2013-03-01' AND '2013-03-31'GROUP BY trunc(createdDate, 'HH')[/code]But I don't know if that's right, and I'm lost on the other queries. Any help would be really appreciated!

How to Set value from another sp in SQL

Posted: 23 Apr 2013 09:53 PM PDT

Hi All,I am trying to write an SP but stucked. in a situation I am trying to set sub_serial_no and for that I have written SET @sub_serial_no = ([u]exec[/u] GetSubmissionSerialNumber 1)if I execute only exec GetSubmissionSerialNumber 1 then I am getting the value but when I run the above sp it shows me.I want to set @sub_serial_no by calling the earlier sp (GetSubmissionSerialNumber)How do I set that?Please help!!

No comments:

Post a Comment

Search This Blog