Finding Duplicates Across Columns
Hi,I have a table that contains animal records. I need to construct a "family tree" query that returns the various generations which is fine. I then want to highlight if the same animal appears more...
View ArticleTwo Select statements without UNION
I have two tablesDept table with 8 recordsLogins table with 23 recordsbelow query should display 31 records, but it is displaying 184 records (8*23=184).i want below query to display 31 records without...
View Articlefour part naming oblivious oracle default value
i have linked server to oracle.when i insert like that insert into [LinkedSRV]...[xfer_in_order] (seq_id, action_type, action_code, batch_id)values(2001, 'PTL_TEST', 'M', 'Batch001')he put the value...
View Articlecheck if record exists then update else insert
i have to check if record exists in table , if there is record then update else insert.Stg_tableId seq name company1 1 aaa yyy1 2 aaa bbbtable Id seq name company1 1 aaa yyy1 2 aaa bbbnow I have...
View ArticleSQL Linked Server and column data
Hello folks,I have very unusual situation in one column so if you could assist it would be great.First of all, I have linked server and I've used this command to get linked server:[code="sql"]EXEC...
View ArticleProblems joinning tables using "with".
I am trying to show where I am having the issue, I need to do a join on the "temptable" table to get the value of "book_number", if it matches in the last SELECT it will be excluded from the data...
View ArticleAnother AD OPENQUERY problem
I have combed the forums for an answer to this but cannot find one. I have written an OPENQUERY statement which works perfectly on my local SQL Server installation on my computer. First I create the...
View ArticleLook up for a table name from another Table
I have a procedure that has this Update statement[quote]@TableName varchar(128) ,@SourceCount intif @TableName = 'AcctStatus' BEGIN update dbo.MonitorDetail set NoOfRowsLoaded = isnull((select count(1)...
View ArticleNull in my Union - but not by itself?
HI,If I run this query it returns exactly what I want in column2 (a date)[code="sql"] SELECT 'Benefit Table Last Refresh Date', CAST(CAST(MAX(last_user_update) AS DATE) AS NVARCHAR(10)), CASE WHEN...
View ArticleSubstring a value after a period
I get string values as input, e.g 'Documentation.Account', whatever value I get I want to extract it to get anything after a period(.) e.g'Account' I was thinking of using Substring, but I'm not sure...
View ArticleInline table-valued function to list numbers
Hi everyone,I'm a newbie and recently I've come across an excercise quite complex (for me). In short, these are the requirements:A - an inline table-valued function with 1 parameter (an INT);B - the...
View ArticleEmbedded Text Qualifier Bug
Recently we migrated from SQL 2008 to 2014. I have come across an error that only is happening on the 2014 environment, but working successfully in 2008. Embedded text qualifiers are failing on the new...
View ArticleQuery
I have a truantday table that has students who has absent, each row is one student, one truant day starting from beginning of school year to current date.I would like to find out in every past 30...
View ArticleCopy/Insert Data to another table with different number of columns
Hello guys,This would be me example. I have some query and my final table looks like:[quote]|Country|Region|Mark|RW|December 26, 2015|January 2, 2016|January 9, 2016|... etc.[/quote]Also I have and...
View ArticleData entry for rows about events that are linked by a visitID
I'm trying to wrap my head around what approach to use in building an application that allows daily import of data and data viewing and entry (update of existing data). The part I need some ideas for...
View ArticleCREATE STORE PROCEDURE OPENQUERY
Dear Friends,I have Syntax like this : INSERT INTO DATABASE_A.DBO.TABLE_A ----THIS IS THE LOCAL SERVER SELECT S_C, S_N FROM OPENQUERY ([LINK_SERVER],'select S_C, S_N, from DATABASE_B.dbo.TABLE_B')this...
View ArticleStrategy to Move incremental data from Migration Server to Target System in...
Hi All,We want to migrate data from Migration SQL server database from final layer to Target(Sql Server) server into respective table . There are two type of data that will be migrated first one will...
View ArticleQuery Question
Hello All, Please see the image of what I am trying to accomplish [img]https://i.imgsafe.org/b511c9d15f.jpg[/img]I tried to add the following code to get the value for FordwardSchdDate ( CASE WHEN...
View ArticleQuery Stuck causing Locks, but I see SP:StmtCompleted in SQL Profiler
Hi,I am experiencing an lock issue.The head blocker query is the following:INSERT INTO DIMENSIONHIERARCHYLEVEL...
View ArticleCall Wcf Service from SQL Server using SQL CLR
Hello All,I want to call Wcf service (developed using .net framework 4.0) from Sql Server Stored procedure.(Version 2014).I have do the lots of R&D but not able to find the correct...
View Article