hello. A question please. What is the separator for sql statements in SqlServer I'd want to write many statements and then depending on the cursor position, to execute it.
Thanks...
hello. A question please. What is the separator for sql statements in SqlServer I'd want to write many statements and then depending on the cursor position, to execute it.
Thanks...
Thanks. Another question please. when I do:
select
* from customer;I see the information of the 2 tables. Are there a way to only see 1 table depending on the cursor position
Thanks in advance
select *
from (customer left join master on unique ID)
It would be very courteous if you were to indicate that your original question was properly answered, and by whom.
And then post your new question separately. This seems an abuse of the 'feedback' system.
I am sorry Arnie Rowland. I wanted 2 things in the same question, but one related to the other another. Separator and execution depending on the cursor. I do that with another database and It works fine.
Anyway you are rigth.
to say that the question was properly answered, must I click on "Mark as answer" on your post
Thanks you and I'm sorry...
First your original question. The semicolon CAN seperate SQL Statements, but TSQL does not require a statement terminator. The query compiler knows how to seperate statements in most cases without one. There are a couple of situations in SQL Server 2005 where you must use a semicolon now when there are multiple statements (like before a CTE).
For your second question, technically this is not possible. Code in SQL Server is not tightly coupled with the editor as much as it is in .NET languages. There is little interaction between the UI and the compiler. So just placing your cursor on a statement will not give the expected results. When you press go, it just sends all of the code in the code window to be compiled, then executed.
You can highlight a statement (or statements) and then the higlighted code will be executed. So you can sort of do what you want, but not exactly.