I have been trying to run debugging within SQl server management studio and for some reason the debugger has just stopped working. This is the message I get: Unable to start the Transact-SQL debugger,…
Tag: tsql
How to fill missing dates and values in partitioned data?
How to fill missing dates and values in partitioned data? I’m having a lot of trouble Googling this as most of the posts seem to feature Oracle databases, and I’m working with Microsoft SQL Server. I have the following hypothetical table: I want to fill in the dates in between the gaps and copy over the value from the most
Is there a T-SQL command that checks whether the object to which a synonym refers exists and is valid?
I’m trying to test if all synonyms on a database refer to valid objects, using the SQL batch script below, as part of a clean-up effort on our databases. This script just performs a query against the synonym, and printing out any errors it encounters. This works fine on views and tables, but not on sprocs. Is there’s an command
Printing integer variable and string on same line in SQL
Ok so I have searched for an answer to this on Technet, to no avail. I just want to print an integer variable concatenated with two String variables. This is my code, that doesn’t run: It seems like such a basic feature, I couldn’t imagine that it is not possible in T-SQL. But if it isn’t possible, please just say
Join two tables and concatenate multiple rows of a single field
Query: Current Output: Desired Output: I would like to join two tables, #Table1 and #Tabl2, on a key column, ID, and get Value field from the 2nd table… but in a single row (as shown in desired output). How (if possible) can I achieve the Desired Output? Thank you Answer For SQL Server 2017 and Later Versions Result Set
Getting records with month by month, year by year and day by day from SQL Server
I’m looking for a fast and easy SQL Query to get records year by year, month by month and day by day. My database example: ID – DATE – CatID – VALUE 1 – 2013-08-06 – 32 – 243 2 – 2013-…
Distinct random time generation in the fixed interval
I’m trying to generate a random time between 8:00 AM and 8:00 PM for each row that is selected from a data set, however, I always get the same random value for each row – I want it to be different for each row. Table schema & data: Сurrent SQL statement: Current results (same time for each row in the
‘MOD’ is not a recognized built-in function name
I wanted to use MOD function in SQL Server 2008R2 and followed this link but still got the message: ‘MOD’ is not a recognized built-in function name. Error: Msg 195, Level 15, State 10, Line 2 ‘MOD’ is not a recognized built-in function name. Why I can’t use this function from the link above? Answer The MOD keyword only exists
Execute a Stored Procedure Inside a View?
I started working for a company a few weeks ago, and have inherited a crazy mess of databases. I’m currently working on designing the new systems to replace their older ones. The previous developer created a ton of views that are entirely identical, with the only differences being the conditions within the WHERE clause. In my attempt to cleanup the
concatenate tinyint datatypes column using derived column in ssis
I have asked a similar Question before but this time I have problems with single-byte unsigned integer What I am trying to achieve is Column 5: Columns 1, Column 2, Column 3 and Column 4 data types is Tinyint but for Column 5 I need it as a string preferably varchar 100. So I tried: But I can’t seem to