Skip to content

Tag: sql

Postgresql – Compare a string with a null value

I’m a bit puzzled because I believe the answer to this question is fairly simple but I’ve searched and tried several options and couldn’t find the right answer. The database is a PostgreSQL 13.1 I am using an API which sends a JSON object to a stored function in the database as follows: The …

Display the total amount of each products below the table

I’m using itextpdf to display the sql query I was able separate the table according to PROD_NAME, and calculate the total amount of each products by getting the sum(amt) over(partition by prod_name) as total_amt from the sql query. Now, I’ve been trying to display the total amount of each products…

sys.tables vs COUNT

I have a variable @tableName (NVARCHAR(255)) that is name of a table. I’m trying to perform an action if data exists in the the table. There are two ways to check this. Method #1 (bulky) Method #2 (clean) Are methods #1 and #2 doing the exact same thing? Is it safe to use method #2? Can there be case wh…

Data Structure for One Entry with Unknown Number of Tags

Noob here. I am trying to create a class or data structure where each entry has one unique name and an unknown number of descriptive tags. I’d like the data structure to be something I could also easily export to some common format (I am guessing that CSV would not be able to do what I am asking since I

TRIM or REPLACE in Netsuite Saved Search

I’ve looked at lots of examples for TRIM and REPLACE on the internet and for some reason I keep getting errors when I try. I need to strip suffixes from my Netsuite item record names in a saved item search. There are three possible suffixes: -T, -D, -S. So I need to turn 24335-D into 24335, and 24335-S …