I’m a newbie in SQL and with programming languages in general. I’m trying to make a tabled function in SQL (SQL Server): and then I have to call it in another sql page. I’ve tried to use this syntax: If I run my SELECT I don’t have any result, because my parameters are not initialized. How can I insert values
Tag: database
How to use a variable with multiple values as a parameter in the where clause sql
I am trying to create a “where clause” that can handle multi-valued parameter but not getting it to work. With the above sample table I wish to create a query that filters the rows with colors red and blue using a variable parameter like the following: I tried using the STRING_SPLIT function but didn’t get it to work (result output
How to select students with marks in all three subjects less then 100
I came across this question Here is my response to it, I just started myself learning SQL recently. Select a.roll_number , a.name , b.roll_number from student_information a join …
ERROR 1064 (42000) while creating a table and database in mysql
I am getting following error while executing my mysql query via a .sql script, but couldn’t tell what is causing this error. I am using mysql Ver 8.0.23 for macos10.15 on x86_64 (MySQL Community …
How to get the most liked users on a particular date in django
So I have a social media app, where users can like the posts of other users. Now I fetch the top 20 users who have received the most number of likes. Everything is perfect. But the problem is I cant …
Query not executing as expected, returns -1 no matter what
I’m working on a user login system for a semester final. I am using C# in Visual Studio with ADO.NET. I have a query that I use on a database table named Credentials: SELECT * FROM Credentials WHERE …
Why can’t I loop through and drop databases?
There is a scenario where I want to go through and remove all databases that have specific text in the database name. It always drops one database and then does nothing. How can I fix this? def …
Merging databases – adding rows that not existing in one db to another
I have 2 databases from Wordpress website. There was happenned issue and 50% of my posts dissapeared. I have database 1 copy from 03.03.21 And existing database 2 of website from 24.03.21 So in database 1 i have many posts thats was deleted And the database 2 has some new posts that not exist in older database 1 Is there
How perform a transaction in ibm db2
I’m working with an accounts table I tried to run this sql which transfer funds from one account to another. I got this error savepoint “FIRST_SAVEPOINT” does not exist or is invalid in this context.. SQLCODE=8080, SQLSTATE=3B001, DRIVER=3.69.56 What could i do ? I’m using IBM Data Studio 4.1.2 and IBM DB2 Express-C Thanks for all the help Answer In
How to loop array of objects from table column?
Table columns : My table column details has json object like I want to write a query which will give me records like below : I tried with RESULT WITH COUNT : EXPECTED Answer To get all the objects from json array along with other columns you can use OpenJson() and Cross Apply as below: Query: Output: id cnt name