Re: SET NOCOUNT ON OPTION
From: Philippe [MS] (ptrotin_at_online.microsoft.com)
Date: 10/19/04
- Next message: Ian Oldbury: "Re: debugging stopped after Service Pack installed"
- Previous message: David Portas: "RE: A SELECT statement that assigns a value to a variable must not be"
- In reply to: Derrick Leggett: "Re: SET NOCOUNT ON OPTION"
- Next in thread: Aaron [SQL Server MVP]: "Re: SET NOCOUNT ON OPTION"
- Reply: Aaron [SQL Server MVP]: "Re: SET NOCOUNT ON OPTION"
- Reply: Adam Machanic: "Re: SET NOCOUNT ON OPTION"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 19 Oct 2004 10:51:32 +0200
You set that value to ON when you do not want to see the row count number
after an insert or update operation.
If your store procedure just SELECT things, do not hesitate to put SET
NOCOUNT ON at the begining of the store procedure.
If you want for example to create a store procedure that make an insert if
the line does not exist and an insert if not, you can do :
UPDATE ...
IF @@ROWCOUNT = 0
BEGIN
INSERT ...
END
Therefore, you need to have the NOCOUNT set to OFF
Phil.
"Derrick Leggett" <derrickleggett@yahoo.com> wrote in message
news:uc40yFZtEHA.2196@TK2MSFTNGP14.phx.gbl...
> No, the SET NOCOUNT is specific to the procedure and is set at execution
of
> the procedure.
>
> "Leon" <vnality@msn.com> wrote in message
> news:ur62eAZtEHA.1400@TK2MSFTNGP11.phx.gbl...
> > But you always have to set it to NOCOUNT OFF after the action within the
> > store procedure right?
> >
> > "Adam Machanic" <amachanic@hotmail._removetoemail_.com> wrote in message
> > news:OPl5RXYtEHA.2196@TK2MSFTNGP14.phx.gbl...
> > > Personally, I use it at the top of every stored procedure, always. I
> > > never
> > > want the rowcounts returned...
> > >
> > >
> > > "Leon" <vnality@msn.com> wrote in message
> > > news:uZiEERYtEHA.412@TK2MSFTNGP14.phx.gbl...
> > >> When and when not to set SET NOCOUNT ON?
> > >>
> > >> I know what it does but not exactly where and when I want to use it.
> > >>
> > >>
> > >
> > >
> >
> >
>
>
- Next message: Ian Oldbury: "Re: debugging stopped after Service Pack installed"
- Previous message: David Portas: "RE: A SELECT statement that assigns a value to a variable must not be"
- In reply to: Derrick Leggett: "Re: SET NOCOUNT ON OPTION"
- Next in thread: Aaron [SQL Server MVP]: "Re: SET NOCOUNT ON OPTION"
- Reply: Aaron [SQL Server MVP]: "Re: SET NOCOUNT ON OPTION"
- Reply: Adam Machanic: "Re: SET NOCOUNT ON OPTION"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|