Generate a sequence in SQL based on the column values

Generate a sequence in SQL based on the column values Problem Description: I need to generate a sequence in SQL Server 2016 database based on the following logic. I have three fields each represents ID of Brand, Category and the Product. A brand could have multiple categories and each category could have multiple Products. I … Read more

The conversion of a varchar data type to a datetime data type resulted in an out-of-range value in Windows Form

The conversion of a varchar data type to a datetime data type resulted in an out-of-range value in Windows Form Problem Description: I am working on a program that takes the values of the columns of the table created in mssm into the datagrid, among these columns are columns with dates. In Microsoft SQL Server,the … Read more

The conversion of a varchar data type to a datetime data type resulted in an out-of-range value in Windows Form

The conversion of a varchar data type to a datetime data type resulted in an out-of-range value in Windows Form Problem Description: I am working on a program that takes the values of the columns of the table created in mssm into the datagrid, among these columns are columns with dates. In Microsoft SQL Server,the … Read more

Group 2 columns and exclude groups containing any nulls

Group 2 columns and exclude groups containing any nulls Problem Description: I want to only return the distinct collection_time group, for only collection_time groups that contain at least 1 non null row for the blocking_session_id field. I can’t get it right. Here is some example data. In the example below, the 2 rows would be … Read more

SQL Pivot and Group By By Date and Totals

SQL Pivot and Group By By Date and Totals Problem Description: I am using SQL Server 13.0 Developer Edition. I can’t make the correct structure for the SQL code with Pivot and Group by clauses. I have data like; Id OperationType Date ResultCode 1 BeginTransaction 2022-12-01 16:54:30 -28 2 BeginTransaction 2022-12-02 18:54:30 -30 3 BeginTransaction … Read more

How to map a MS SQL Server table that has a UNIQUEIDENTIFIER primary key?

How to map a MS SQL Server table that has a UNIQUEIDENTIFIER primary key? Problem Description: Using sqlalchemy 1.4, I want to map a class to a table that has a UNIQUEIDENTIFIER primary key. Using sqlalchemy.String does not work (complains about the fact that you cannot increment it). Checking dialects, I tried to used sqlalchemy.dialects.mssql.UNIQUEIDENTIFIER, … Read more

How to return Y/N if product is either Red, Green, or Blue

How to return Y/N if product is either Red, Green, or Blue Problem Description: I have a SQL table that looks like this (t1) ________________________________________________ |Id | ProductName | ColorID | ProductDescription| |1 | x | 7 | x | ————————————————- And I have another table that contains the Colors (t2) _________________ | Id | … Read more

How to return Y/N if product is either Red, Green, or Blue

How to return Y/N if product is either Red, Green, or Blue Problem Description: I have a SQL table that looks like this (t1) ________________________________________________ |Id | ProductName | ColorID | ProductDescription| |1 | x | 7 | x | ————————————————- And I have another table that contains the Colors (t2) _________________ | Id | … Read more

We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Accept
Reject