Join 2 tables with a reference table
I have two large tables that I am trying to join together by two columns. Below are the tables with two samples in each table, the reference table and also the final result that i want. Can anyone help...
View Articlelooking for query for below output?
Hello Experts,I have couple of master tables and those are linked with my audit table.For example, below are 2 master tables,CREATE TABLE MASTER1 (MASTER1_UID INT IDENTITY(1,1) PRIMARY KEY, MASTER1_VAL...
View Articlehelp in update data
Hi, I am unable to update in entity column and gets the error. How I can update this script successfully. Any help please.My SQL-Script-------------------update pruder set hr_tb=345 where...
View ArticleRemoving Double Quotes from column values
Hi All,I have a table Customers. in thich i have a column 'status' .The colum status have values as below."A""A""A""U""U"I want to update this whole column and remove the double quotes from the values....
View ArticleRequest : Information on ORMASK function
Hi All, Can some shed light on ORMASK function ? I tried looking to find some information about this on BOL but could not find any :( i can get only following information when i run SP_helpdb is...
View ArticleDetect Current IDENTITY_INSERT Settings?
Is there any way to programmatically detect the current value(s) of the IDENTITY_INSERT property, specifically (a) whether it's ON or OFF, and/or (b) if it's ON which table it's on for?I have a table...
View ArticleNeed help aggregating some rows into separate columns
Hi I'm having a hard time writing this query. I have a table like so: hour_ran name ethn Group laps_ran 4:00 Holly Russian A 5 5:00 Holly Russian A 3 6:00 Holly Russian A 1 4:00 Sergio Spanish B 2 5:00...
View ArticleColumn To rows
I have a table like the followingServername Databasename Logtype Filepath ServerA DB1 Data C:\DB1.mdfServerA DB1...
View ArticleHow to implement poor-man's version control with TSQL queries
I have a table called Project. Each row completely describes a project and has a username, project name, project description and other numeric parameters that contain all the data about the...
View Articlehow to avoid duplicates in CROSS JOIN Query
Hi,I am using CROSS JOIN to get all the subset of a table col values as shown below: PRODUCT (Col Header) Bag Plate Biscuit While doing cross join we will get as Bag Bag Bag Plate Bag Biscuit Plate Bag...
View ArticleArithmetic overflow error converting expression to data type int When...
Hello, everyone,I encountered the error :"Arithmetic overflow error converting express to data type int" when updating a table as follows:UPDATEt1SETt1.Count1 = t2.Count2FROMTable1t1JOINTable2...
View ArticleSame code, one it's ok the other one return me Invalid lenght
Guys, today I'm getting crazy with my SQL. I got this code:SELECT subString([LINE KEY],charindex(':',[Line Key])+1,6) as period, [Elements], LEFT([Elements],charindex (',',[Elements])-1) as element,...
View ArticleHow to specifically sort the data in a database using c#?
H!, I have a problem in c# that require sorting of names of students in a sql database and i want it to be specific, i used data grid view to view the data of the students as shown below: Students...
View ArticleTop 10 sum & count
I have been working on this Select statement all day (blogs & testing) and I guess it's time to seek some help.This is for my golf league to determine who is in the lead and determine the points...
View ArticleBasic doubt in CTE
Hi all, Learning CTE in deep, I encountered the sentence "Enable grouping by a column that is derived from a scalar subselect, or a function that is either not deterministic or has external access"...
View ArticleCase Statement Not returning resutlset Varbinary
Declare @val varbinary set @val = cast('123456789' as varbinary) select @val as value -- Varbinary Value Result Declare @check bit set @check= 1--THis Case Statement Not returning Result set in...
View ArticleSessions?
can some one explain what a session is?if i write a query in a new window - thats a new session? if i run the query once - the sesion is over?if i execute the query twice - this is the second...
View ArticleAdding Additional Tables to an Existing Query
Dear AllI have the following tables and relationships:I have the following query that returns records from the table SENAlert where the StudentID and the TeacherUsername are passed in as parameters....
View ArticleUse of SUM and COUNT with GROUP BY
All,I have a set like below:State DOB StartDt EndDt Desc Category MemberID SubID Code NC 2003-01-30 2014-01-01 2014-01-31 Child B 123456 2 38 NC 2003-01-30 2014-01-01 2014-01-31 Child B 123456 2 39 NC...
View Article