Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x

Query Syntax

50K

Solutions

19K

Contributors

SQL (Structured Query Language) is designed to be used in conjunction with relational database products as of a means of working with sets of data. SQL consists of data definition, data manipulation, and procedural elements. Its scope includes data insert, query, update and delete, schema creation and modification, and data access control.

Share tech news, updates, or what's on your mind.

Sign up to Post

This is a basic sp but it returns a 1 properly but will not return anything when the statement is true. I'm sure my null trapping is not correct. Also not sure I dealt with the output parameter correctly in terms of how I set it equal to the case statement.
@pi_enterprise_id  CHAR(5),
@pi_practice_id  CHAR(4),
@txt_pregnum            INT,
@problem                  VARCHAR (150),
@pi_cur_person_id  UNIQUEIDENTIFIER,
@datefield            VARCHAR(10) OUTPUT
)
AS

select  @datefield = (CASE WHEN (datefield is null or datefield = '') then '2'
ELSE '1'
END)
from ob_problem_list_
where person_id = @pi_cur_person_id
and pregnum = @txt_pregnum
and problem = @problem
and cpsp_problem_indicator = 'Y'

0
[Webinar On Demand] Database Backup and Recovery
LVL 11
[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Want to build powerful, database-driven websites? You can learn how in the November Course of the Month, with a focus on PHP, MySQL, and CakePHP MVC framework.
0
Enroll in this month’s featured course to get 19+ hours of PHP, MySQL, and CakePHP MVC framework training.
1
Your access to October’s Course of the Month expires today! Enroll now and begin adding Microsoft SQL to your professional skills.
0
v2-native-ad-no-button.pngOnly five days left to enroll in October’s Course of the Month! Once you enroll, you’ll have 30 days to complete the Microsoft SQL Server and Database Concepts course.
0
native-ad-no-button.pngThe end of October is approaching and you only have nine days left to enroll in our Microsoft SQL Server and Database Concepts course. Enroll today and take advantage of this complimentary Course of the Month training.
4
Have you enrolled in this month’s complimentary course? Enroll now for a free Microsoft SQL Server and Database Concepts course. Get 7+ hours of step-by-step SQL training, including possible topic interview questions.
0
I've a stored procedure SP1 built. It has 8 columns n 6 rows. I also created a table T1 with exact 8 columns as SP1 and this table is empty. How do I insert 6 rows from SP1 into T1? Does the insert statement need to be inside the stored proc SP1 or can be it a separate query?
0
 
LVL 125

Expert Comment

by:Andrew Hancock (VMware vExpert / EE MVE^2)
You may want to post this Question, in the Microsoft SQL Server, SQL, Query Syntax topic areas, to get an Answer.
0
 

Author Comment

by:LION KING
Thank you Andrew.
0
native-ad-no-button.pngOctober’s Course of the Month is available! Enroll today to get 7+ hours of step-by-step Microsoft SQL Server training.
4
This is a cool tool to help visualize explain plans in postgres: https://explain.depesz.com/
2

Query Syntax

50K

Solutions

19K

Contributors

SQL (Structured Query Language) is designed to be used in conjunction with relational database products as of a means of working with sets of data. SQL consists of data definition, data manipulation, and procedural elements. Its scope includes data insert, query, update and delete, schema creation and modification, and data access control.