logo

Warning: The forum is now for consultation only. Please use GitHub Discussions to post any questions or comments.


Welcome Guest ! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
j.torres@tewis.com  
#1 Posted : Wednesday, January 22, 2020 8:58:08 AM(UTC)
j.torres@tewis.com

Rank: Member

Groups: Registered
Joined: 4/7/2019(UTC)
Posts: 24
Man
Spain

Thanks: 7 times
Hello.
I need to generate a model that should include a CTE. Before generating a SQL model, I was wondering how can I implement it using a meta model. Which object/element should I define in order Seal generates automatically the correspond CTE clause?

Thanks.
epf  
#2 Posted : Monday, January 27, 2020 8:07:33 AM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 206 time(s) in 199 post(s)
You can use CTE clause in all SQL...

Using the server manager, create a new table and enter the SQL, it should work.
example for SQLServer:

Code:
with cols2 as (select * from sys.columns) 

select * from cols2


Then if you create a model with this table the SQL generated will look like:
Code:
with cols2 as (select * from cols)
SELECT DISTINCT
  CTETable.object_id AS C0,
  CTETable.name AS C1
FROM (
select * from cols2
) CTETable
ORDER BY CTETable.object_id ASC,CTETable.name ASC

Edited by user Monday, January 27, 2020 8:09:02 AM(UTC)  | Reason: Not specified

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.