Showing posts with label pull. Show all posts
Showing posts with label pull. Show all posts

Sunday, February 26, 2012

event viwer

Is there a way to pull the event viwer from a system sp or
xp with out writing a new xp?Jared,
"pull" means? you can use master..xp_logevent or RAISERROR (...) WITH LOG to
log a user-defined message to the Event Viewer. Does that help?
--
Dinesh.
SQL Server FAQ at
http://www.tkdinesh.com
"Jared Kirkpatrick" <jared@.hgpdev.com> wrote in message
news:83da01c35abd$5cc29280$a001280a@.phx.gbl...
> Is there a way to pull the event viwer from a system sp or
> xp with out writing a new xp?|||That works if I need to log an event, but I need to read
the events.
>--Original Message--
>Jared,
>"pull" means? you can use master..xp_logevent or
RAISERROR (...) WITH LOG to
>log a user-defined message to the Event Viewer. Does that
help?
>--
>Dinesh.
>SQL Server FAQ at
>http://www.tkdinesh.com
>"Jared Kirkpatrick" <jared@.hgpdev.com> wrote in message
>news:83da01c35abd$5cc29280$a001280a@.phx.gbl...
>> Is there a way to pull the event viwer from a system sp
or
>> xp with out writing a new xp?
>
>.
>

Wednesday, February 15, 2012

Even and Odd numbers

I need to figure out how to pull records if the id is even or odd.
ie
ID Name
1 bill
2 john
3 joe
4 jane
for example i need a idea of a select statement that will pull the even records 2 and 4.
is this possible?you should able to use the modulo operator... something like (for even)

select *, CAST(ID AS int) % CAST(2 AS int) AS Modulo
from table where Modulo = 0

I think that should do it...

To do it for the odd numbers try this...

select *, CAST(ID AS int) % CAST(2 AS int) AS Modulo
from table where Modulo = 1|||thanks rockslide i will give that a crack.