Joining Lookups - capitals & small letters
Hi,Find below a sample data from the lookup tableCODE DESCSCE - SalesCallElectric SCe - SalesCallTech - Electric SCF - SalesCallFluidPower SCf - SalesCallTech - FluidPowerAnd then the main table...
View ArticlePercentage in a query
Hi all, I got this query:SELECT TEMPO, COUNT(NOME) AS NU FROM HISTORY GROUP BY TEMPO ------ nome(nvarchar), tempo (nvarchar)the results:TEMPO NUL 13O 8F 25I need...
View ArticleNeed help in SLA Calulation and Staging the Records
Hi All,I am stuck up with calculation of SLA which is a little complicated. I have achived something but that is not suffice.I have a table with ItemID,Current_Status_major,Current_DateThe value for...
View ArticleUnpivoting a Query
Hi Experts,I have a table which contains the following data.THERA_ID, ENTITY_ID, CHANNEL_ID, DRUG_BRD_ID, TRX1,TRX2....TRX24, NRX1,NRX2...NRX24For each thera, entity, channel and drug...
View ArticleDistributed transaction save tran
Someone calls my procedure from outside with DISTRIBUTED TRANSACTION (SQL 2008).In case of error, I would like to rollback the part, which was done in my database and returns the error message. So, if...
View ArticleHow copy database table contents with SQL scripts?
I have SQL Server 2008 R2 and I would like to copy tables and contents to another instance of SQL Server 2008 R2. There is no network connection between these 2 servers so Import/Export is not...
View ArticleSQL 200 Millions rows.... worth looping
Hi, Usually when I deal with large data sets I tend to loop through say 1 millions at a time... Insert one million rows into TableA from TableB Delete the same one million rows from TableBNow whilst I...
View Articlet-sql compare values in same column of a table
Hi, table 1id reason appid index1 abc 123 0 2 abc 123 13 xyz 456 04 pqr 789 0 5 pqr 789 1 6 fgh 333 0 7 bvc 333 1table 2appid date 123...
View ArticleAbreviated month to year to date?
Hi,We have a table that tracks transactions by accounting period, it is a varchar field and it stores the information in a mmm-yyyy format. I have been asked to create a report that includes year to...
View ArticleSQL Query
Hi, I have got two table in SQL Server, "building_master" and "building_units". In the first table, I am adding the names of all the buildings and in the second table I am adding the units (flats) in...
View Articlesql server 2005 STD smalldatetime datatype value was not changed
HI AllMS SQL server 2005 STD edition , i have multiple databases, one of the database column datatype is "smalldatetime". this column value is updated through query , query was successfully completed...
View ArticlePIVOT help and education
I am REALLY struggling with the whole PIVOT concept. I understand what it's doing...like using a result set to create columns...turning a vertical result set horizontally. I just cannot seem to grasp...
View Articleexpection CONVERSATION
Hi i am getting the expecting conversation on a function i am working on and cannot seem to find the cause. Any help would be appreciated/****** Object: UserDefinedFunction [dbo].[[IncrementVersion]]...
View ArticleMulti Value Parameter in a Query.
Can someone guide me thru on how to make this happen, I have a report to generate which will let a user select Customer,SalesRep,Location & Product. I need to write a query which will let the user...
View ArticleSLA Calculation Help needed in Excluding Weekends and Off business hours for...
Hi all,I have to develop a SLA Report. I have already developed using the query in below...
View ArticleT-SQL Where 1=1 and Where 1 = 0 , what is the puprose of this statement ?
Hi friends,I am refering some already developed Reports Store Procedures by other experienced developers in SQL Server.Most of the Store Proc contains Where 1 = 1 in the Select statement's Where Caluse...
View ArticleCLR Application on Sql Server 2005
Hello,I am having issues concerning a third party appliation. I recreated the application, so I can modify it. Currently, The CLR application is an application that emails a report to a user and the...
View ArticleCross multiplication using 2008R2
ID A B C(Result) 1 3 1 3*1= 3 2 5 3 9+15 = 24 3 4 2 6+10+8= 25 4 2 1 3+5+4+2= 14using 2008R2 need to find above...
View ArticleHow to Create Tables on Multiple Database?
Hi,I'm new with SQL.Now I want to create a SQL Script that will create a Table to multiple database.is the a way to loop an Array to just change the database name in creating new tables?Something like...
View ArticleLinear Interpolate
ID Date Value 1 12/03/2013 338907766.4 2 13/03/2013 NULL 3 14/03/2013 NULL 4 15/03/2013 NULL 5 18/03/2013 NULL 6 19/03/2013 319794455.1 7 20/03/2013 NULL...
View Article