UNION two FOR XML('tr') statements
I am trying to build an HTML structure like this: <tr><TD>John Doe (98210)</TD><TD>0.50</TD></tr><tr><TD>jane Smith...
View Articleuse a String name as Date
Hi, I have a column in table as FILE_NAME I want to use the partial string & convert the records of this column as a Date like highlighted in yellow.
View ArticleSql Server - group by based on change in row values
Hi,I have a scenario. I need to make a group by based on value change in rows. Eg - two columns date and value.Jan 1 - 15Jan 2 - 15....Jan 5 - 10......Jan 8 - 15If I group by value I will get Min...
View ArticleLooping Transact SQL
I have an issue regarding the looping.Isthere a way toloop backifno records foundindate filtering.sample, Rightnow thecurrentdate i have startdate'2013-09-1 6:00AM'andEnddate '2013-09-2 6:00AM' which...
View ArticleQuery performance
Hi all,Hope every one is fine.I have a query which look like this, i have a performance problem with this queryselect a.sex,a.age_group,b.organisation,b.name ,sum(b.popualtion),sum(b.population) From...
View ArticleOrder records based on date within certain days range
Hi, Could anyone help to provide some ideas for the following query, I've been stucked for couple days already.I got the following sample table:RecordID ProductID Date 30_First Rank 30_Last Rank...
View ArticleSame database, same client, different server, different behaviour
Dear collegues,I recently was assigned the task to solve a bug. When I tried to reproduce the bug on my local development environment, I couldn't (10 records were returned, as expected). When I asked...
View ArticleDeadlock on SQL server
We faced deadlock while update and insert data on a table cause this issue. I got the below xml at SQL server extended events. Why insert and update leads to dead lock?<?xml version="1.0"?>...
View ArticleComparison
Hi,I have two database on different servers. I got a task to validate the data between those two database.How can we do that?is there any tool for this?Please Mark as Answer if my post works for you or...
View ArticleSQL FIFO Query
Hello all;Like others, I need help developing a SQL query to determine A FIFO Cost for parts. I'll make mine easier that others I have read in this forum by limiting it to one table.I have an Inventory...
View ArticleTSQL Query for Table Column Stats/Data Audit
The Results image above is a bit hard to see thus here are the stat column names:ColumnName, Max Field Length, No OF Records Populated, No OF Populated Records WIth Max Field Length, No Of Populated...
View ArticleQuery to get Member Info
Hi,I have a table which have the following columnsId Member Access BossNameEgAbc123 Peter...
View Articledelete large number of rows without growing the transaction log
So I now have the need to delete a few million records from a few tables. Ive been burned before, so I know this much be done in stages or else it will fill up the transaction log and grind your...
View ArticleInsert Problem
Hi All ,I have 2 tablesOrganization and Customer TableOrganization table columnsorgid it's a primary key not an identity column,firstName ,lastNameCustomer Table First Name,Last Name am issuing this...
View ArticleHow to use trigger to create SQL Agent job on secondary replica server from...
I have 2 Boxes Server A and Server B.I have setup always on high availability between these servers.Server A is primary and Server B is secondary.I want to set up a process like if I create sql agent...
View ArticleRebuild Inex taking long time to execute
Hi All,I have table - MyTable which has 50 millions of records. I created some stastistics & indices on it. After some testing I dropped them & tried to run following query. ALTER INDEX ALL on...
View ArticleHelp on Finding Records
I have a Table IMP in which data is imported from text file .. SID State ShortName 1001 VA Nut 1001 VA Com 1001 VA EOW 1001 VA Plan 1001 VA ECO...
View ArticleOrder by
Field in Error Error Code Total lossSettlementIndicator 16.2 PAOI 18.44 deductibleType 19.14 deductibleAmount...
View ArticleMake a View for forecasting based of a View with existing data
In my database I have a View Revenues with fields ProductID,EditionID, Year, January, February, March,..., December. I need to display in Excel for each ProductID and EditionID all the year and months...
View ArticleKill with status only shows 'Estimated rollback completion: 0%. Estimated...
Environment:SQL Server ENT 2012 SP1 CU5 on Windows 2012.I killed a process executing a stored procedure and when I check the rollback status it shows the following:SPID 860: transaction rollback in...
View Article