SQL Update Multiple Rows value based on same row

We have a table that contains all of our products. In here is a column called UNITMEASURE. This column is populated with values such as “EA, PR, PK, YD, etc”. Occasionally a 1 will get populated into this column. I would like to run an update statement to change the 1’s to whatever the other […]

Database Performance Improvement Structural Design

I has a structural performance question. I am preparing a book selling web site. I has books, authors, categories ect. I want to give users some discounts. But these discount can be about book, category, author and even can be about user. I am storing discounts at ‘discounts’ table and storing types. When people list […]

Http WebRequest with Hebrew characters (SQL Server CLR sp)

I’ve prepared a CLR stored procedure in order to send GET requests for SMS (messaging) web service. This is the code: [Microsoft.SqlServer.Server.SqlProcedure] public static void HttpGet(SqlString uri, out SqlString textResponse) { Uri webUri = new Uri(uri.Value); HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create(webUri); webReq.Method = “GET”; WebResponse response = webReq.GetResponse(); Stream dataStream = response.GetResponseStream(); using (dataStream) { StreamReader […]

SQL Server: How to open a URL using Job script on a timely basis?

I want to open a URL using SQL Server Job Script in Asynchronous way. Currently I am able to make the call to the target. However for some reason SQL Server Job remains active and ‘In Progress’. Don’t know how to stop it automatically after running it once. Kindly help me out guys. Following are […]

Joining a calendar table to find timesheet missing dates

I have a timesheet query that looks like this: User TimesheetStart TimesheetEnd Allen 2014-07-01 2014-07-15 Allen 2014-08-01 2014-08-15 Allen 2014-08-16 2014-08-31 I have a calendar view that looks like this. The [Date] column defines the first date, the 15th, the 16th, and the last date of the month. I need a query that returns the […]

What datatype should I use when adding a column that will contain a null to a Datatable with SQL Server?

I have a client that is sending this data: {“answers”:[ {“response”:true}, {“response”:true}, {“response”:true}, {“response”:false}, {“response”:false}]} I have classes like this: public class AnswerRow { public bool? Correct { get; set; } public bool Response { get; set; } } public class AnswerRowList { public IList<AnswerRow> Answers { get; set; } } In my WebAPI I […]

EntityFramework updating .edmx not working

I made some changes to a table column [A] on my sql database, and tried to “update model from database” in visual studio, but I did not see the changes. I tried to rebuild, but still no changes. I then deleted the column [A] that was not updated from the .edmx [diagram] and update model […]

Unable to print SQL Server 2014 Reporting Services in IE8

My company has upgraded all of its client databases from sQL Server 2008 to 2014 and we have now found that none of our clients are able to print the reporting services reports in IE8. Unfortunately we are required to support the legacy app but I have been unable to find a resolution. When clicking […]

Transaction Count mismatch with layered transactions

I have a group of stored procedures (each of them are a transaction on their own) that I need to be ran as a transaction. I am using a Transaction Scope object as its an all or nothing task. After the first ExecuteNonQuery runs though I get the SQLException “Transaction count after EXECUTE indicates a […]

SQL automatic date range using DateSerial function

We’ve been using MS Access, with the following syntax for MTD Data that works for us: Between DateSerial(Year(Date()),Month(Date()),1) And DateSerial(Year(Date()),Month(Date())+1,0) We need to transition the above logic to SQL/SSRS for automatic emailed reports, but I cannot get this DateSerial logic to work with SQL. In the Filter field of the SQL query, I can successfully […]

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