How can I separate SQL queries

MonsterMMORPG

Assume that I have the following queries

select userName, password, email 
from tblUsersProfile 
where email = '145' or userName = '112'

select userName, password, email 
from tblUsersProfile 
where email = '80' or userName = '70'

select userName, password, email 
from tblUsersProfile 
where email = '129' or userName = '169'

select userName, password, email 
from tblUsersProfile 
where email = '1' or userName = '2'

select 
    AVG(PokemonLevel) as AvgLevel, PokemonId 
from 
    tblUsersPokemons 
group by 
    PokemonId 
order by 
    PokemonId asc

insert into tblOnlineUsersCounts  
   select 
      (select 
          COUNT(LastMoveTime) 
       from 
          tblUsersProfile 
       where 
          LastMoveTime > DATEADD(HOUR, -24, sysutcdatetime())),  
      (select 
          COUNT(LastMoveTime) 
       from 
          tblUsersProfile 
       where 
          LastMoveTime > DATEADD(DAY, -7, sysutcdatetime())),
      (select 
          COUNT(LastMoveTime) 
       from 
          tblUsersProfile 
       where 
          LastMoveTime > DATEADD(DAY, -30, sysutcdatetime()))

select 
    count(Id) as TotalCount, PokemonId 
from 
    tblUsersPokemons 
group by 
    PokemonId 
order by 
    PokemonId asc

Now when I execute them in SQL Server Management Studio, it tries all and if one fails all fails which means all of them is counted as a single query

Also when I right click in SSMS and click analyze query in database engine tuning advisor it also count them as a single query instead of each one is independent queries

So I want to format them in a way that both SSMS should treat them as each one of them is a separate query

So even if one fails, SSMS should execute other working ones

What is the proper format for achieving this ?

Ty very much

what are these downvotes for ?

Radu Gheorghiu

In case an error can occur in any of your queries you should use TRY-CATCH for this error handling.

Also, using GO between your queries is an option.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I find the unique results to 2 separate overlapping queries?

From Dev

How can I subtract two queries in sql?

From Dev

How can I join 3 SQL queries

From Dev

How can I reduce the number of SQL queries I need for this to work?

From Dev

How can I combine 2 SQL queries and retrieve a cumulative count?

From Dev

How Can I merge these two Access Sql queries

From Dev

How can I combine these two SQL queries into a single query?

From Dev

How can I do SQL queries that depend on other rows?

From Dev

How can I index these queries?

From Dev

Can I combine these two SQL queries into one?

From Dev

How can I separate a string into columns, if I have multiple rows and the strings are of different length in SQL?

From Java

How can I view live MySQL queries?

From Dev

How can i speed up these linq queries?

From Dev

How can I use @ in PetaPoco queries

From Dev

How can I minimize the amount of queries fired?

From Dev

How can I optimise Zumero sync queries

From Dev

How can i achieve this in LINQ-Queries?

From Dev

How can I store linq queries?

From Dev

How can I combine these two queries into one?

From Dev

Django conditional queries: How can I avoid this?

From Dev

How can I transform this information to queries?

From Dev

How can I optimise Zumero sync queries

From Dev

How can I improve this queries speed?

From Dev

How can i order by for multiple queries combination

From Dev

How can I add timezone to Esper queries?

From Dev

How can I combine these 2 queries to one?

From Dev

How can I maintain multiple open queries?

From Dev

How can I get these queries to work together?

From Dev

How can I combine these two queries?

Related Related

HotTag

Archive