Using TOP in an UPDATE statement.
[code language="sql"]UPDATE #TEMP_STPSet Signature_Date = Top 1 D.Close_DateFrom[SOLICIT].[GTM_DOC] D, #TEMP_STP, [SOLICIT].[GTM_DOC_PROD] P whereD.[SOLICITATION_ID] = P.[SOLICITATION_ID]<
View ArticleAgain, trying to use a value with the max Close Date
[code language="sql"]UPDATE tSET Elig_Flag = P.ELIGIBILITY_FLGFROM #TEMP_STP tCROSS APPLY ( SELECT P.ELIGIBILITY_FLG FROM [SOLICIT].[GTM_DOC_PROD] P INNER JOIN [SOLICI
View ArticleIs this Deadlock due to Lock Partitions?
The same update ran a few miliseconds apart. It causes deadlock. Col2 is primary clustered key. In execution plan, It's only one step which is Clustered Index Update on Col2.i
View ArticleDynamic Pivot Help
Hello forum, I am new to posting as I try to read a lot to address problems i have had in the past. I have searched the forum but cant seem to find anything I need to put me on the right path.I have...
View ArticleDeriving group members from nested groups
Hello All, Any input would be appreciated. I have some working code that derives group members from nested groups. There are two changes I need to make and when I do the code no longer works.
View ArticleQuestion about a composite key and autoincrement
Hello all,I was recently assigned to convert an Access database to Sql Server. I have to try and keep the structure the closest properly because some other programs use this database.This concrete...
View ArticleSQL uses 2 different executions plan (slow and fast) for a simple query. Need...
Hi everyone,I am experiencing a performance issue with one process in our system. The performance issue is intermittent, the users say that it is working just fine for ~10 minutes and then it is slow...
View ArticleIssues with Update using Cross Apply
[code language="sql"]UPDATE t SET response_sol_id = x.[solicitation_id] FROM #temp_stp t CROSS apply (SELECT P.solicitation_id FROM&
View ArticleTriggers
Hi Team,I have created one single trigger to capture information modified by the insert/update/delete commands.is there any performance difference if we create 3 separate triggers(like after insert...
View Articleupsert in ssis for large tables
I have 40 tables having different structure in one of DB on one server that is being updated by data provider.I want to create a SSIS package that would pull data from that data provider DB and insert...
View ArticleConnect MS SQL Server with Progress 4gl OpenEdge database
Hi,I want to create a connection to Linked Server with Progress 4gl database. MS SQL Server is on local machine and Progress Database is hosted on Cloud (IS Corp). Can you tell me how to connect with...
View ArticleHuge time hit with a subquery
Before i added this, my code ran in under 1 minute. Now, it takes at least 6 minutes (I stopped query at 6 minutes)Is there a better way to do this?[code language="sql"],ZATS = (Select top&
View ArticleOpenRowSet No Field Terminators
Hi,To start I have minimal experience with OpenRowSet and BCP. I usually do processing with SSIS but this new project is using SQL Server Express so I don't have that luxury. I need to import data...
View ArticleSSRS Report: Any way to copy or download either an RDS file or the text...
It's been a while since I dealt with SSRS. Am hoping to find an easy way to either download a shared data source as an RDS file, or somehow come up with the text necessary to create one from...
View ArticleCopy File To Active Node In AO Environment
I have a process that needs to occasionally copy a file to a local drive on the active node of an AlwaysOn environment (SQL Server 2014 running on Windows Server 2012 R2 servers). This environment has...
View ArticleAVG a range of dates while grouping them by supplier
I have multiple suppliers with a purchase order date. I'm trying to calculate the average time between purchase orders but keep it grouped by supplier. I thought I could assign a row_number and over...
View ArticleAdd Group ID value for set of sequential rows
HiTo be honest I wasn't sure how to phrase this subject, I hope it makes sense after I describes my needs. I have a file(s) that need to be imported where the format is a single column of data where...
View ArticleHow does SQL Server handle concurrent operations?
Hello,We are having an issue which I suspect is database related. We have a web application on which we can upload files. When we upload a file, data from that file gets saved to a SQL database. We...
View ArticleHow can I cache an execution plan from SSMS
Hi,After I ran a query in SSMS, I can't find the execution plan in the cache.Is there any way I can tell SQL to cache the execution plan ? My goal is to run a query with a set of values and get the...
View ArticleBatch Update Performance
Hi all,I have a batch UPDATE I'm trying to use to populate a new column for historic data on some fact tables in our data warehouse (up to around 1,000,000,000 rows per table). The code is structured...
View Article