I am setting a stored procedure for select and I want to update the value of one column in the database Before doing the Select. This is what I tried but it’s not working. @roleID int and @query …
Tag: sql-server
what is difference between ceiling and roundup server in sql server
What is difference between the Ceiling and Round functions in in SQL Server? I have some query and I get a totally different value in Round and Ceiling function.
Dynamic Pivot of Email Addresses
I have tried to research this, and I am unable to find something quite like it. I have a table that may have entries added many times over as well as deleted. I have no idea how many columns I will …
SQL REPLACE value based on position in string
I have a column where the values are all in this format ‘###-##-#-##-##-###-##-#’ I need to format all of the values to where the 2nd to last hyphen is replaced with a period ‘###-##-#-##-##-###.##-#’ …
Casting to a decimal in SQL
The max value in my table for measure_rate is 572. The below query returns that value. SELECT cast(max(measure_rate) as decimal) FROM [SurgicalMeasures] WHERE measure_rate != ‘N/a’ and …
How to trim all lowercase characters that comes before an uppercase character in a string using sql server
How can I write an SQL Server query to trim all lowercase characters that comes before the first uppercase character in a string? e.g. string value “eaplgCostPrice”, remove “eaplg” and pass “CostPrice”…
Generate unique Identifier for table
I’m trying to create a table in SQL Server. I want to generate a unique identifier 32 bit and be the primary key. I define it as primary key and set the type – how I can turn on the generation? How I …
SQL: Nested Select vs Double JOIN by Performance
I have report based on a stored procedures and I need to add User name into output. In my system TWO users can be owners of transaction. Also, in my system User information stored in different …
Returning a number when result set is null
Each lot object contains a corresponding list of work orders. These work orders have tasks assigned to them which are structured by the task set on the lots parent (the phase). I am trying to get …
SQL subquery with latest record
I’ve read just about every question on here that I can find that is referencing getting the latest record from a subquery, but I just can’t work out how to make it work in my situation. I’m creating …