SQL Server Performance

Accessing a field in SQL

Discussion in 'Getting Started' started by Pankaj18, Aug 3, 2009.

  1. Pankaj18 New Member

    Hi,
    We have schedule a job through SQL agent
    in which
    We want to access the data of a specific field from SQL table
    For example we have a field named interviewDate, we have to compare it with current date.
    now we have to write a stored procedure to read the date field.
    This is incorrect syntax which we tried(doesn't work)

    create procedure chkinterview
    as
    select * from interview
    if(interviewdate!='2/7/1900 12:00:00 AM')
    print'ok'
    else
    print'not ok'

    what will be the syntax to access all the record of interviewdate field.
    Later we have to insert that data into another table through a stored procedure.
    Thanks !
    Pankaj Singh

  2. FrankKalis Moderator

    not really sure if i understood correctly, but your procedure could look something like this:
    CREATE PROCEDURE chkinterview
    AS

    SELECT
    *
    FROM
    interview
    WHERE
    interviewdate <> '1900-07-02';
    GO
    But what is your ultimate goal here?

Share This Page