19
Views
3
Comments
Solved
SQL Query
Question

Not understanding SQL query 


SELECT *, (SELECT COUNT(1) FROM #TempAppTagToProjectList) AS TotalCount FROM     (SELECT ROW_NUMBER() OVER (ORDER BY @OrderBy) AS RowId    , * FROM #TempAppTagToProjectList ) Main WHERE Main.RowId between @StartIndex and @EndIndex

Why is hash symbol used #TempAppTagToProjectList

Solution

Hi Albatross,


Without more info regarding the query, i would guess that it is realted with a temporary table that it is created before that specific "Select" statement. 

It's not common in outsystems, but it can be used on the advance sql queries. 

Usually, something like this when declaring temporary tables : 

create table #Temp
(
    ID int, 
    Title Varchar(50), 
    ...
)
mvp_badge
MVP
Solution

Hi Albatross,


The #<Table name> is the syntax for a temporary table in SQL server (see more here).

It's not often used in OutSystems as it is hard to maintain and therefore only used in more advanced scenarios, so I can imagine there is a good reason for it to be there, but not knowing the context, it's hard to give you a more concrete answer than this.


Kind Regards,
João

Solution

Hi Albatross,


Without more info regarding the query, i would guess that it is realted with a temporary table that it is created before that specific "Select" statement. 

It's not common in outsystems, but it can be used on the advance sql queries. 

Usually, something like this when declaring temporary tables : 

create table #Temp
(
    ID int, 
    Title Varchar(50), 
    ...
)
mvp_badge
MVP

Hi Albatross,

This is the OutSystems forum, and as such the questions asked here should have some relation to the OutSystems Platform and apps created with it. General development questions like your generic SQL question should not be asked here. Instead, you can post them on sites like Stack Overflow. I'm going to close this topic now.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.