I have an ASPX page using VB.net code, and it is set up to run a series of SQL queries and populate a SQLDataReader with the results. Each SQL query is pulled from a specific field in a table within the SQL database. This code works perfectly for literally every query I run through it, except one. The VB code
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 | | ————- |——-…
avoid explicit cast to float?
Can SELECT CAST(2.083 AS float) AS c be written in a more compact way ? Something like SELECT 2.083f AS c ?
How can I turn this query that uses a join statement into a query that uses a subquery?
I’m given the query and told to rewrite it using a subquery. I tried writing but I get an error saying the column isn’t recognized? Answer You are trying to access sub-query (or inner query) table’s column outside and hence the error. Please try this:
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…
Using LIKE in SQL with multiple search terms
I’m doing a basic SQL course and learning the basics currently and having issue with filtering: Task: list all the rows from TableName where the columnName field content does not contain any of the following words: ‘stack’ or ‘overflow’ or ‘exampleword’. -> I get i…
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?