I want to remove particular value from my string. My string can be of any length. E.g. string 1: {“ABC”:1,”ABC_DT”:-1,”ABC_DBQty”:0,”ABC_DSQty”:0,”ABC_LMT”:1,”ABC_DT”:-1,”CTSD”:”TEST”,”SD”:1,”…
Tag: sql-server-2014
How to store T-SQL query output in new table with date of that day when query executed
I have to created a query which i have to run daily and attach the output in Excel. But what I want is to schedule the query to run on a daily basis and the output will get stored but I’m not able …
LEFT JOIN: The multi-part identifier “_” could not be bound
For the below query I am getting following error: Earlier these were implicit joins but trying to resolve i changed them to explicit inner joins but still I am getting this error. What can I try next? Answer Never use commas in the FROM clause. Always use proper, explicit JOIN syntax. So, write the FROM clause as: You no longer
Getting wrong output in pivot query
Attendance Table Sample Data – Student Table Sample Data – StudentSubject Table Sample Data – Subject Table Sample Data – Output – Wrong output is displaying with parameters – As 2,1,0 and NA,NA,1 should be displayed instead 2,1,1 and 2,1,1 is displaying. Couldn’t point out the mistake I am making. Can somebody take a look ? Answer You are missing
N”’ prefix is added by default while executing Stored Procedure
While executing stored procedure, I’m passing 4 arguments. After passing the arguments through GUI mode, I’m seeing that some prefixes has been added by the sql itself. So when I am removing the N”, it’s giving me an error saying Invalid column name ‘BSCCS’. What does it mean ? Full Stored Procedure – The problem with this is I am
Ignore Sunday while generating student attendance report in SQL
This code gives me the attendance report between two dates passed as a parameter. I will pass dates respective of the month selected from the C# code. But I want to skip Sundays while generating the attendance report. How can I achieve this? Answer How about changing #TempDates? This assumes that your internationalization settings are set to “English”.
Replace `0` with `N/A` or `-1` in pivot query result
I have Attendance table in which date and attendance is stored and I am passing date range in this query to display attendance report. Now my question is how can I replace 0 (which I am getting as a output if the date passsed doesn’t match with the date inside the Attendance table) with N/A or -1 ? Answer You
Covert a duplicate Row value into column using pivot table
Here is my stored procedure query to fetch data in first table. I have following Data in a temp table. I want Name 1, Name 2, Name 3 as column and their value against the respective item.Data in table is dynamic.There can be any number of Items and any number of Name. For every Name and Item their is a
Rounding dates to first day of the month
I am using SQL Server 2014 and I am working with a column from one of my tables, which list arrival dates. It is in the following format: ArrivalDate 2015-10-17 00:00:00.000 2015-12-03 00:00:00.000 …
How to check active transactions in SQL Server 2014?
I am using SQL Server 2014 and want to know how to check my active transactions? Answer Query with sys.sysprocesses DBCC OPENTRAN : helps to identify active transactions that may be preventing log truncation. DBCC OPENTRAN displays information about the oldest active transaction and the oldest distributed and nondistributed replicated transactions, if any, within the transaction log of the specified