I have a table with a column named [xml] of type varchar(max) column with HTML Tables in each line, such as: in a Microsoft SQL Server 2008 R2. I want to know how many occurrences of a table header there is. I have inconsistencies because all headers were supposed to be the same, but they are not. I have to
Tag: sql-server
Stored procedure with string as parameters not working -SQL
In my database ‘Student_name’ is set as varchar. And the stored procedure is: ALTER PROCEDURE [dbo].[SP_STUDENT] @STUDENT_NAME NVARCHAR(MAX), AS DECLARE @columns NVARCHAR(MAX) = ”,…
SqlCommandBuilder Update Command is Generating Command but Not Updating Database From DataGridView
I am inheriting a form class (Form1) for Form 2. Form 1 code works without error. In Form 1, I use SqlCommandBuilder(SQL.DBDA).GetUpdateCommand to generate the update command for my Datagrid to pass to SQL data table which again works perfectly and the table is updated successfully. The SQL command text for F…
Include indicator of data present, but not include in results
I can’t quite explain it properly, hence the awful title. As an example, I would have a query that shows customer complaints, of a certain type, and the dates since those complaints. Something like …
SQL: Is there a way to capture “once every 45 days”?
First time post, but I’ve stumbled across Stackoverflow for years. A patient might get a particular lab test many many times in a span of a few months. However, to reduce duplication, I only want to …
Select only certain rows from a where in query in SQL
I have a query trying to get duplicates from a table of user invites. I can get the duplicates through a “WHERE IN” clause and filter that list to be duplicates where at least one of the duplicates …
SQL query does not return correct results
I am trying to filter between two dates on a SQL server from a PHP process. This is the query: select * from webStocks where FECHAMODIFICADO between ‘2020-06-03 17:16:02’ and ‘2020-06-04 17:16:03’ …
SQL: Getting previous record from other table
I want to get the previous record of each record in Table A from Table B. for easy, below is the table sample data: drop table if exists #A drop table if exists #B CREATE TABLE #A(Name varchar(10), …
Check Constraint with Filtering Logic
I have a table that has bit column called “Flag” it does not allow NULL. A requirement here is to ALWAYS have Flag=1 set for every Id in the table below but only 1 time per each unique Id and Flag columns combination. At the same time all other rows can be have Flag=0 set multiple times if there a…
Does sqlsrv_query limit the number of statements that can be exectuted in one query?
I am generating a SQL insert statement within a PHP for loop. The SQL string generated is a large number of individual SQL statements like this: INSERT INTO tbl VALUES(1,2,3); INSERT INTO tbl …