473,396 Members | 1,995 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to return table based on if condition in Postgesql

CREATE Procedure [dbo].[GetMstDropdowndata]
@FieldType varchar(100)='Typeid'
AS
BEGIN
if @FieldType='IsOptionalid'
BEGIN
SELECT 'Yes' as ddlvalue,'Yes' AS ddltext
union
SELECT 'No' as ddlvalue,'No' AS ddltext
END
else if @FieldType='Categoryid'
BEGIN
select [CategoryId] as ddlvalue ,[CategoryName] as ddltext
from [CategoryMaster] order by CategoryName
END
END

How to convert above sp in Postgresql
Sep 21 '21 #1
0 4337

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Sreeneet | last post by:
HI all, In SQL Server, i have a function which will return a table. like create function fn_test (@t int) returns table as return (select * from table) now i want the function to retun the...
3
by: Raghuram Banda | last post by:
Hi, I was strucked in a problem, basically I'm working on Sortable Table and the table is created using HTML Tags and one of the fields in the table contain Date in unix format (something like...
6
by: dummie_q | last post by:
Hey, I am having some confusion about how to formulate this particular query. I have 2 tables. Table A has 4 columns say a1,a2,a3,a4 with the columns a1,a2,a4 forming the primary key. Table B...
5
by: das | last post by:
hello all, this might be simple: I populate a temp table based on a condition from another table: select @condition = condition from table1 where id=1 in my stored procedure I want to do...
0
by: Dan | last post by:
I have an access database that contains a linked dbf table that is based on a shapefile in ARC-Editor. I would like to auto-update a table based on the new records that have been entered into GIS....
1
by: Maxwell2006 | last post by:
Hi, I am working with strongly typed datatables. What is the most efficient way to build a new DataTAble based on the result of DataTable.Select? At this point I use a foreach loop to do the...
2
by: MrCrunchy | last post by:
Hi All I have 2 tables (as shown below), if i add a row to the FILES TABLE then the myid value is added to mydata list in the PLAYLISTS TABLE, based on the genre matching the myname values. Hope...
16
by: Malcolm McLean | last post by:
I want this to be a serious, fruitful thread. Sabateurs will be plonked. Table-based programming is a new paradigm, similar to object-orientation, procedural decomposition, or functional...
3
by: Shukaido | last post by:
I'm a VERY novice SQL user. I've got an Access ADP project connected to an SQL 2000 Server. My dilemma is that I have a single table that stores all data for my particular project, with links...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.