Viewing 15 posts - 121 through 135 (of 297 total)
Should be a very basic query. Try
SELECT Object_Id, Schema_Name, Table_Name, SUM(Value1) AS Value1, MAX(Date1) AS Date1
FROM Table
GROUP BY Object_Id, Schema_Name, Table_Name
ORDER BY Object_Id, Schema_Name, Table_Name
July 19, 2022 at 6:33 pm
Okay, that did shed more light on the issue.
It seems the view and tableB reside in different databases. This is a problems, since the sys.xxx files do not span databases...
July 19, 2022 at 4:50 pm
I could see as attached.
Ahh, okay. I think you'll have to comment on that image, because there isn't much to see after you have redacted most of the information....
July 19, 2022 at 3:34 pm
Also, if you run this:
SELECT
o1.Name as ReferencingObject,
o1.type_desc AS ReferencingObjectType,
d.referenced_server_name,
...
July 19, 2022 at 2:51 pm
Stange! My tests don't show this behavior. What do you see in SSMS when you look at the dependencies? Do the view show as a reference from TableB?
July 19, 2022 at 2:14 pm
Please note that if the the view references a table through a synonym the direct reference from the table will not be there. Maybe this is your use case?
July 19, 2022 at 12:27 pm
I'm attempting to utilize this query, but I've discovered that HasViewDep is not producing accurate results. Some of the tables are used in inner view select statements (subqueries or...
July 19, 2022 at 11:52 am
Hmmm... That's a strange way to join two tables, but you'll probably have your reasons. It doesn't make sense to me - it seems very arbitrary. Anyway the only thing...
July 15, 2022 at 10:53 pm
Okay, maybe I'm a bit daft, but couldn't you simply use this:
CREATE OR ALTER VIEW Test
AS
SELECT *
FROM Calendar C
LEFT JOIN Events E ON C.CalendarDate BETWEEN E.EventStartDate...
July 15, 2022 at 8:10 pm
Even though the MS documentation states that literals longer than 4000 characters are cast as NVARCHAR(MAX) this doesn't seem to be the case.
July 14, 2022 at 11:49 pm
A slightly different approach
SELECT
CONCAT(SCHEMA_NAME(t.schema_id), '.', t.name) AS TableName
, t.create_date AS CreatedDate
, t.modify_date AS...
July 14, 2022 at 8:03 pm
I'd say its purpuse is to strip leading zeros from (I'm guessing) a numeric string in the col column, i.e. '000001200' becomes '1200'. This is useful for example when processing...
July 13, 2022 at 5:12 pm
With the understanding that I've not done any deep analysis on any of the code posted and going only on what I've seen in the past, the nested REPLACEs...
July 13, 2022 at 3:52 pm
Just to be sure. You want to?
July 12, 2022 at 7:27 pm
Since SQL Server 2016 you can use the STRING_SPLIT() function, which means that you can do something like this:
SELECT * FROM View_Session WHERE BookID IN(SELECT CAST(value AS...
July 12, 2022 at 6:33 pm
Viewing 15 posts - 121 through 135 (of 297 total)