SQL Query Help - PIVOT or CROSS APPLY?
Hi, I have a dataset that looks like this:[code language="sql"]CREATE TABLE [dbo].[PivotData]( [PayPlan] [nvarchar](255) NULL, [CategorySubGroupCode
View ArticlePerformance Issue with Simple Query /Big Tables
This query (attached estimated query plan) returns Exception of type 'System.OutOfMemoryException' was thrown. Are queried tables just too huge or can query p
View Articlevery slow select
Team,I have this query that runs quite a long time, actually the result is not been displayed at all.
View ArticleWays to search Faster In Ms SQL Server
I want to know the different ways to search fast, efficiently in MS SQL Server. Someone please help me?
View ArticleDifferent Index size value for Indexed View
Hi,I have one indexed view. when I checked it through SP_SPACEUSED and DMVs, it gave me different Index size values.when I used sp_spaceused 'vw_Intraday_Indexed', it gave me below O/Pname rows &n
View ArticleChecking Fulfillment of Prerequisites That Can Contain Elaborate AND/OR...
I am working with a system in which I can query prerequisites for course enrollment in a query like this:[code language="sql"]SELECT [td].[PEOPLE_CODE_ID]&n
View ArticleInside out on my Where clause logic
WHERE(B.ELIGIBILITY_FLG <>'Y' or B.ELIGIBILITY_FLG is NULL)and DM.ELIGIBILITY_FLG <>'Y'B is Sol Tracker and DM is Duty ManagerI want to see all rows where B is not Y or B is Null. But I...
View ArticleCombining Two Queries into Single Query
The view gives the below output.[code language="sql"]CREATE VIEW V1 AS SELECT SELECT DISTINCT
View ArticleWhen will entire Procedure get Re-Compiled
Working on a legacy procedure with multiple select statements . From dm_exec_query_stats was able to identify when each of these query got the part of plan recompiled ( should be due to stats update on...
View ArticleRecursive CTE for Supervisor Hierarchy WITH Effective Date of Reporting...
Okay, I'm editing my request per Lynn's suggestion. Below, in the comments, I'm posting the DDL to generate the sample data and the expected result set vs. what I have right now. The current method...
View ArticleTruncate Table Over Linked Server to Oracle
Is there any way to do a table truncation across an oracle linked server? I have looked up methods to do with linked servers but only found solutions for sql server to sql server linked servers. I...
View ArticlePermission - Execute as - Issue
Hi,Having some trouble seeing where the issue is here: [code language="sql"]alter PROCEDURE pec.jpwPermissionTest1_20190128withEXECUTE AS ownerASBEGIN-- this one f
View Articleaccess token value
Hi,i have the below script :{ "access_token": "7mYWLVjfbttKjxT4_T_rL8SGFMKHjjjhhiTTkklkhKHKKHKKxatwAUi2BaD5e6uJcRPdP9Gf261RnwUZQf4X7jfAfh8BgoQ7pHsj4z9VqlaZ3FdI8t7TZs0P-txg0JU-zJg", "token_type":...
View ArticleOrder BY clause in View using Stuff Function.
I have two views.My First View definition[code language="sql"]CREATE VIEW FIRST_VIEW AS SELECT PT.F_PRODUCT AS F_PRODUCT, PT.F_TEXT_CODE AS F_TEXT_CODE, PHT.F_PHRASE AS F_PHRASE,F_COUN
View ArticleBeginners Question
Hi Guys,I clearly don't understand how SQL deals with negative selection.Please consider the following:[code language="sql"]create table #a (Colour varchar(20), Size varchar(10))<
View ArticleHow to add year to membercode already exist on table firstprintcardfooter
ProblemCannot add year to this query [code language="sql"]SELECT FirstPrintCardFooter.FooterNotes,FirstPrintCardFooter.
View ArticleTwo selects, a column is invalid in the the second Select,but not first
t.Duty_Saved is an INVALID COLUMN Name in the second Select but not the first.Odd. Thoughts? thanks [code language="sql"]use GTM_ODS;if object_id('TEMPDB..#tempProto')
View ArticleMerge Multiple Rows into a logic
Good Day,Please find below my requirement :[code language="sql"][/code]--SOURCE TABLE CREATE TABLE [dbo].[SourceTable]( [P_NUMBER] [varchar](20)
View ArticleFind individual column mismatch between source and target
Hi All,[code language="sql"]Source table:CREATE TABLE EMP_CLIENT( ID INT NOT NULL, NAME VARCHAR (20) NOT NULL, AGE INT &n
View ArticleLAG Function, to compare two rows
I need to have SQL look at the previous row and comare the previous row is a "Y" or an "N"in the eligibility column. I need to know WHERE the current row is a "N", but the row immediately above is a...
View Article