Forum Replies Created

Viewing 15 posts - 271 through 285 (of 568 total)

  • RE: writing a query to search all columns at the same time(like a Wildcard search)

    Hi,

    search with WILDCARD is working well in the varchar/char columns

    and if the @log_number is null then

    try this

    where

    username like ('%' + @username + '%')

    [sys] like ('%' + @sys+...

  • RE: Select Case

    Hi,

    Also try this

    create table #temp

    (

    slno int,

    GRI int,

    JUMPSTART int,

    REMASTERS int

    )

    insert into #temp

    select 11,1,2,3

    union all

    select 22,2,3,4

    union all

    select 33,3,4,5

    union all

    select 44,4,5,6

    declare @result varchar(10)

    set @result = 'GRI'

    select * from #temp

    where GRI = (case when...

  • RE: problem with nulls

    hi,

    For better assistance, post you procedure

  • RE: select the most appearance

    hi,

    nice coding by Dave and clive

    suppose the count occure same for 2 cars then?

    like

    insert into #cars values('ford')

    insert into #cars values('ford')

    insert into #cars values('ford')

    insert into #cars values('ford')

    insert into #cars values('honda')

    insert...

  • RE: Convertion of integer to Datetime format

    DATETIME to INT

    declare @time1 datetime

    set @time1 = getdate()

    select convert(int,@time1)

    print @time1

    INT to DATETIME

    declare @time int

    set @time = 40042

    select convert(datetime,@time,112)

    print @time

  • RE: Convertion of integer to Datetime format

    Hi,

    try this

    select convert(datetime,40010/*your int value*/,112/*your format*/)

  • RE: Convertion of integer to Datetime format

    Hi,

    Are you sure this int column having 10 digit characters?

  • RE: How to exec a stored procedure in DB1 against data in DB2 with user havng no access to DB2

    Hi,

    Ref this Topic related to the SETUSER (user can process with the other user name)

    http://www.sqlservercentral.com/Forums/Topic767655-146-1.aspx

  • RE: Execution Error

    Hi,

    Try this

    alter proc usp_get

    as

    begin

    declare @sql Nvarchar(100)

    select @sql = 'create view dbo.vw_select as select '+char(39)+'2009-01-01'+Char(39)+' As a'

    print @sql

    exec sp_executesql @sql

    end

  • RE: distinct comma separated values

    hI,

    Also Try this

    DECLARE @values VARCHAR(500)

    SELECT @values = coalesce(@values+',','')+GENDER_DESC

    FROM MST_GENDER

    GROUP BY GENDER_DESC

    SELECT @values

  • RE: Problem with Averages

    The TEST table having some the duplicate records

    So that the variance occurs

    create table #main

    (

    slno int,

    col1 varchar(10),

    col2 varchar(10)

    )

    insert into #main

    select 1,'10','10'

    union all

    select 2,'20','20'

    union all

    select 2,'30','30'

    union all

    select 2,'30','30'

    select avg(cast(col2 as decimal(9,2))) from...

  • RE: Dynamic WHERE clause

    create table test

    (

    EmpID int,

    EmpName varchar(20)

    )

    insert into test

    select 1,'Ashly'

    union all

    select 2,'Bob'

    union all

    select 3,'Charles'

    CREATE procedure Emp_name_proc

    (

    @emp_id varchar(100)

    )

    as

    begin

    declare @abc varchar(100)

    select @abc = @emp_id

    select @abc = 'select '''...

  • RE: Problem with Averages

    From the codes i am getting the following results

    select AVG(cast(mrks as int)) AVER from TEST

    AVER

    504

    select AVG(cast(mrks as decimal(9,2))) AVER from TEST

    AVER

    504.271448

  • RE: Dynamic WHERE clause

    create procedure Emp_name_proc

    (

    @emp_id int

    )

    as

    begin

    1) output like

    ‘Bob’

    ‘Charles’

    select EmpName from Employee/*with lock options*/

    where EmpID = @emp_id

    union

    select EmpName from Employee/*with lock options*/

    where EmpID = @emp_id+1

    2) output like ‘Bob,Charles’

    declare @concat nvarchar(1000)

    select @concat= COALESCE(@concat+','...

  • RE: Dynamic WHERE clause

    A1)

    create procedure Emp_name_proc

    (

    @emp_id int

    )

    as

    begin

    select EmpName from Employee/*with lock options*/

    where EmpID = @emp_id

    end

    A2)

    insert into TempEmployee

    exec Emp_name_proc 2

    And it’s not advisable to create the procedure with SP_

    Because it’s also reflects/access to...

Viewing 15 posts - 271 through 285 (of 568 total)