Forum Replies Created

Viewing 15 posts - 46 through 60 (of 82 total)

  • RE: A SELECT question

    select *

    from MyTable

    where (@Lang = Lang and Id = @Id)

    or (Lang = '-')

  • RE: Stored Procedure error- And?

    ...Oh, and I'm very well thanks.

  • RE: Stored Procedure error- And?

    You will need to change the "if" to a "case" (cannot use if in a select):

    and b.arrival_date >=

    case

    when...

  • RE: Variable where clause

    Could try either:

    declare @Var1 varchar(50)

    set @Var = null

    select * from tblNews_Items where division = isnull(@Var1,division)

    select * from tblNews_Items where (@Var1 is null or division = @Var1)

  • RE: primary key definition

    table_pk is the primary key constraint name. In this case they are using the table name plus "_PK" to make up the name. Therefore if your table was called tblEmployee,...

  • RE: triggers

    Enterprise Manager, select Table, right click menu: All Tasks > Manage triggers.

  • RE: "SELECT field(1) FROM Inserted", exist?

    Well, your explaination of what you're after is not all that clear, but how about adapting:...

    declare @TableName varchar(255)

    declare @PosWanted int

    declare @ColWanted varchar(255)

    declare @Columns table

    (

    Position int identity(1,1),

    ColName varchar(255)

    )

    set @TableName = 'TableName'

    set...

  • RE: update

    ?

    update Table1

    set Table1.Email = Table2.Email

    from Table1

    inner join Table2 on Table2.Name = Table1.name

    ?

  • RE: Sql Server Challenge -- can it be done?

    It's certainly possible in TSQL, you just need to loop through the table replacing the duplicate values.

    In the following example the values are inserted into another temp table (to set...

  • RE: Number Formatting

    My above comment refers specifically to integers rather than Money values

  • RE: Number Formatting

    The General way that I use is a small user defined function that takes in an int, converts it to a string, before inserting commas in the appropriate places.

    This scalar...

  • RE: Simple way to determine columntype in t-sql

    It does, as usertypes are also stored in the systypes table.

    There are complications though, as usertypes share the same xtypeId as their parent datatype, so this query returns both.

    I'm sure...

  • RE: Simple way to determine columntype in t-sql

    Query the system tables, specifically the columns and the datatype tables

    declare @tbl varchar(255)

    declare @col varchar(255)

    set @tbl = TableName

    set @Col = ColumnName

    select systypes.Name + '(' + cast(syscolumns.length as varchar(100)) + ')'...

  • RE: Why is the Forum so slow

    nickel01: Note the "Forums Powered by Snitz" link at the bottom of the forums pages.

  • RE: Conversion to DATETIME

    Could create a function that uses this code, and refer to the function in the table's computed column. At least this keeps the code out of the table ddl code

    ...

Viewing 15 posts - 46 through 60 (of 82 total)