Skip to content

Tag: sql-server

Invalid Object Name – Tried a few things

I have the following query: It keeps telling me ‘invalid object name’. The table exists. I checked the drop-down to ensure the right database is connected. I refreshed Intellisense cache. Not sure what else to do… Answer I think you are looking for linked server object names, if so then you …

Finding highest reached threshold

I have a table that contains 2 columns that store values of certain thresholds that can be reached. The table columns are: ThresholdValue (INT), Reached (BIT) and the table looks like this: …

SQL Pivot on Conditional Count

I have a table of vulnerabilities using SQL server, when I perform the following query select * from table The output looks like so. | Name | HostName | Week | | ————- |——-…

SQL to Get Latest Field Value

I’m trying to write an SQL query (SQL Server) that returns the latest value of a field from a history table. The table structure is basically as below: ISSUE TABLE: CHANGEGROUP TABLE: CHANGEITEM TABLE: EXPECTED RESULT: So each change to an issue item creates 1 change group record with the date the chang…

How to filter records in sql server? [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 2 years ago. Improve this question I hav…

SQL Server substring throws error “multiple results”

I use Microsoft SQL Server 2016. I have a column that is called Failover and looks like his: I want that number so I use : It works fine, but if I want a second column called Account, it crashed with multiple results… How to fix this ? Is there a simple way to take the second number and third?