Re: Returnung data with a running date timeframe



On Thu, 28 Dec 2006 05:58:00 -0800, chas2006 wrote:

Hi Hugo...I am not familiar with the Decalre statement. I work in Query
Analyzer exclusively with Select statements. Will Declare and Set update,
delete or change any live data in the tables.

Thank you.

Charlie

Hi Charlie,

The DECLARE command is used to declare a variable. So, after executing

DECLARE @MyVariable int;

SQL Server will reserve memory for the storage of a variable of the
integer type, known as @MyVariable. (Note: all variable names must begin
with @ in SQL Server).

The SET command is used for various things. It is part of the UPDATE
command, but by itself, it can be used to change database or connection
settings or to change the value of a variable. The syntax used in my
code was the latter version. Another example:

SET @MyVariable = 1;

After this command, the memory space reserved for the variable
@MyVariable is set to the integer value 1.

BTW, you could have found all this by checking Books Online. :-)

--
Hugo Kornelis, SQL Server MVP
.



Relevant Pages

  • Re: IN(@variable) clause and Table Data Type variable
    ... > separated character values all enclosed in pairs of single quotes. ... > also need to use a Table data type variable which raises error when EXEC ... > command is run. ... > -- declare and set Table variable ...
    (microsoft.public.sqlserver.programming)
  • Re: In(@variable) clause and TABLE datatype variable
    ... > separated character values all enclosed in pairs of single quotes. ... > also need to use a Table data type variable which raises error when EXEC ... > command is run. ... > -- declare and set Table variable ...
    (microsoft.public.sqlserver.programming)
  • IN(@ListVariable) and TABLE Data Type
    ... separated character values all enclosed in pairs of single quotes. ... running Exec command on it but I ... -- declare and set Table variable ...
    (microsoft.public.sqlserver.server)
  • IN(@variable) clause and Table Data Type variable
    ... separated character values all enclosed in pairs of single quotes. ... running Exec command on it but I ... -- declare and set Table variable ...
    (microsoft.public.sqlserver.programming)
  • In(@variable) clause and TABLE datatype variable
    ... separated character values all enclosed in pairs of single quotes. ... running Exec command on it but I ... -- declare and set Table variable ...
    (microsoft.public.sqlserver.programming)