Tag: sql-server

SQL Transpose \ Pivot

I am trying to do a weekly summary of individual items from the original table. The query should return 1 row for each specified Item type (i.e. Doors, Windows, etc) if no item is returned, it should return null values Original Table +——-+———–+———-+———–+——-+——+ |ITEMID | Date |ItemType |Account No |Amt | Desc | +——-+———–+———-+———–+——-|——| |10 […]

Cache looks like never been made in ASP.NET SQL

I’m developing website with query notification using SqlCacheDependency. When the website loads for the first time, if there is any cache, it retrieves the data from the cache while the opposite, if there is no cache, it retrieves data from database and then insert the cache. When the user inserts data, and clicks a button, […]

Powershell: Cannot index into a null array

So, I’ve got an interesting issue… I’ve got two Server 2012 boxes set up, one with a default instance of SQL Server 2012 Enterprise Edition, and the other with a named instance of SQL Server 2012 Express Edition. I’m in the process of writing a Powershell script that will audit SQL Server 2012 against the […]

no backup selected for restore sql server 2012

I am trying to restore db from my db backup file when i select and add the db .bak file I have seen that error “No back upset selected to be restored” I also tried from script to restore it but failed. kindly tell me some effective way to do that?? I have already tried […]

Pivot rows to columns SQL 2008

I have done quite a bit of review here and have gotten close to what I need, but I am stumped on the last little bit (or so I hope). I am using dynamic pivot to transpose my data from DocID PropID StrVal NumVal DateVal 5938 21 TARRO, THOMAS A III NULL NULL 5938 21 […]

Column Store Indexes Update With table locking

I’m currently working on a tricky task. Background: I have a MSSQL 2012 database with multiple tables and a huge amount of rows. Since searching takes quite a while in this database, i search for ways to improve the queries. (And yes I’m using indexes, already had look to the execution plan and stuff like […]

SQL Server 2008 ssrs multiple records into one

I’ve been reading other similar “multiple records into one” posts, but either cannot seem to get any to work, or they don’t really apply to what I am trying to do. Here are my 3 tables. vehicle, vehicle_repair, comments vehicle columns: vehicle_name and other vehicle related info,vehicle_make, vehicle_model vehicle_repair columns: vehicle_name, vehicle_repair_type, vehicle_repair_num, etc, etc […]

SSRS Chart in tablix with Column Break

I wanted to create a multicolumn report with paging. For complexity I have Gauge control in first row and Chart control in second row. I have data from table like this MetricID | ColumnNo | RowNo    1         |    1            |    1             2         |    2            |    1             […]

SQL Server : Replication Error – the row was not found at the Subscriber when applying the replicated command

I got the following error in Activity Monitor, The row was not found at the Subscriber when applying the replicated command. (Source: SQL Server, Error number: 20598) After some research, I found out the error occurs because it’s trying to delete records which are not exists in the subscriber(Also are not exists in publisher) {CALL […]

Choosing and assigning a value based among the duplicate records in sql

My data looks as below: Student_ID State 1 WI 1 IL 1 IL 2 WI 3 IL 4 IL 4 MN I want my Output to be as follows: Ouput: If the same student is in both WI and any other state then we need to mention as ‘multiple’, when student is only in WI […]

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