I need to create a stored procedure that needs to return a count of some records. I’m using .Net to read the result. I can use an OUTPUT parameter to return the value or I could do a select count(*) …
Multiple LEFT JOIN in Access
I have the following query, which works for MySQL: But it doesn’t work for MS Access. I’ve tried to add parentheses around the LEFT JOIN, but it gives me syntax error in FROM clause. So how should this query look in order to work in MS Access? Answer The Access DELETE requires a star (*): DELETE *…
How to create trigger in informix?
I am trying to write a trigger like in the following simplified example: This fails! Only this works: What am I doing wrong? Answer I think you should write a stored procedure with the IF – THEN logic and call that from this trigger. I think triggers support only simple SQL statements, not SPL statement…
Oracle cascade delete
Is cascade delete on a table more efficient than individual delete statements (executed in a single plsql block) ? Answer What cascade delete does is issue individual delete statements. Examine the following test case: In the trace file, you will find a line like this: That is Oracle issuing a delete statemen…
Update same table as selected with calculated values using resultset
I’m new to sql (scripting). Single CRUD commands are no problem, but I’m trying to create a stored procedure that wil update a table with a calculated value using the results from the same selected table. In the table there is a value with the total vacation-hours for each employee and a value of …
Need to perform ORDER by Twice
I want to sort according to date first and then if date is similar then according to id..How to do that in Informix/HSQL query? Answer A good tutorial on this SQL ORDER BY
Change PostgreSQL columns used in views
I would like PostegreSQL to relax a bit. Every time I want to change a column used in a view, it seems I have to drop the view, change the field and then recreate the view. Can I waive the extra protection and just tell PostgreSQL to let me change the field and then figure out the adjustment to the
Select something that has more/less than x character
Was wondering if it’s possible to select something that has more/less than x characters in SQL. For example, I have an employee table and I want to show all employee names that has more than 4 characters in their name. Here’s an example table Answer If you are using SQL Server, Use the LEN (Length…
Accessing database connection string using app.config in C# winform
I can’t seem to be able to access the app.config database connection string in my c# winforms app. app.config code C# code: When I try the C# code, I get a message: Warning 1 ‘System.Configuration.ConfigurationSettings.AppSettings’ is obsolete: ‘ This method is obsolete, it has been re…
sql getting information, but in wrong order
I have the following query in sql: a1 = the name I need the information in the table to output the names its queried in the order ive asked, so I need 40 to be first then 28 so on on. The reason for this is my code reads the results and stores in an array that then is used