Questions tagged [code]
12 questions
7
votes
2 answers
Best practices for committing a transaction in SQL Server where TRY CATCH is used
In a SQL Server code block, what is the best place to place the commit transaction? Inside the try catch block or outside it?.
For example, is option A or option B the correct approach or are they subjective choices?
Option A
CREATE PROCEDURE…
user20358
- 213
- 2
- 4
- 6
3
votes
1 answer
Improve select query performance
The following select query from my application is taking more than 200ms. The table has around 2 million rows. Is there any ways to improve the performance of this query ?
select count(id) from table1 where status='A' and empID=123
Table…
IS_EV
- 181
- 3
1
vote
1 answer
Oracle PLSQL code recovery
I cannot connect to my database as admin, even using connect descriptor neither via RMAN. I am getting TNS-12514 error.
I consider to install new instance.
Questions:
1) Can I restore/recover PLSQL code from "dead" oracle database?
2) Where is the…
Jakub P
- 167
- 1
- 2
- 10
1
vote
2 answers
How can I get this code to work? It's in mysql, I keep getting an error 1822' failed to add foreign key constraint. Missing index for constraint'
CREATE TABLE EMPLOYEE (
employeeNumber VARCHAR (15) NOT NULL,
employeeName VARCHAR (20) NOT NULL,
department VARCHAR (10) NOT NULL,
phone INT NOT NULL,
PRIMARY KEY (employeeName, department)
CREATE TABLE DEPARTMENTS(
department VARCHAR (10)…
Enrisen Tzib
- 13
- 3
1
vote
1 answer
Does CUBRID have Information Schema Views?
I am trying to access the Information Schema views as defined in SQL92, and cannot find any in the CUBRID RDBMS. Has CUBRID implemented this specification and how can I access them?
CUBRID version: CUBRID 10.1, manual:…
Erdinc Ay
- 167
- 2
- 11
0
votes
2 answers
SQL to check if a certain time duration occurs within a particular period of the day
I'm working with data that has a start datetime and end datetime column for each event which can be a short period of time
(Few hours) up to a number of days in duration.
I'm trying to establish a way to check for where the following is true:
the…
DynamoRanger
- 13
- 1
- 3
0
votes
3 answers
What is back-end programming?
I like to know what exactly is the back-end programming? Does it include offline databases? Everyone who designs and creates databases and tables is a back-end programmer? What do they mean exactly by server side programming? By which languages they…
user3486308
- 151
- 1
- 6
0
votes
1 answer
MYSQL - Operand should contain 1 column(s) - Nested Case statement
I have written the below query with nested case statements. The syntax checks out but when I run it I receive error code 1241: Operand should contain only 1 column(s). I have attempted to remove the parenthesis from the SELECT statements but it does…
MilfordTechnologyGuy
- 3
- 1
- 2
0
votes
1 answer
Access Send Email. Loop Not Building Table
I’m stumped on this one. I have an action item list on a fairly large Project Management DB. This list is datasheet that is embedded as a subform on a PopUp form from the Main Menu. On the Action Item table I have a [email] field that is used as a…
AdamB
- 88
- 2
- 9
0
votes
1 answer
I am trying to run this code and I get an error at line 11
CREATE TABLE IF NOT EXISTS `tblproduct` (
`id` int(8) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`code` varchar(255) NOT NULL,
`image` text NOT NULL,
`price` double(10,2) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY…
G1234
- 1
-1
votes
1 answer
MySQL code error
Can someone please tell what is wrong with below SQL code?
CREATE TABLE student (
student_id INT PRIMARY KEY,
first_name VARCHAR(20),
major VARCHAR(20),
);
-1
votes
2 answers
I want to select many columns from many tables without foreign key
I have three tables, and I want to fetch the three table data without a foreign key.
Say I have a table product_1 which contains (id, name) and table product_2 contain (id, name, price).
I want to select the columns of the two tables in one query.
I…
znzoony
- 1
- 1