Forum Replies Created

Viewing 15 posts - 436 through 450 (of 569 total)

  • RE: Help me regarding this ....

    hi,

    very basic piviting code,

    try this

    create table #temp

    (

    EmployeeID varchar(2),

    StructureID varchar(2),

    StructureAmount int,

    DeductionID varchar(2),

    DeductionAmount float

    )

    insert into #temp

    select '01', '01', 13500, '01', 70.0

    union all

    select'01', '02', 1500, '02', 0.0

    union all

    select'01', '03', 1230, '03' ,500

    union...

  • RE: Table variable error in dynamic SQL

    happycat59 (5/13/2009)


    INSERT INTO @table EXEC(@SQL)

    SELECT

    *

    FROM @table

    Hi,

    Is this works in the SQL?

    ref the post: http://www.sqlservercentral.com/Forums/Topic711409-338-2.aspx

    ARUN SAS

  • RE: indian authors for sql server book

    anu1krishna (5/11/2009)


    hi all

    can anybody provide me the name of indian writers for sql server beginners book which i shuld buy to increase my knoledge

    Hi,

    Why only Indian why not others?

    ARUN SAS

  • RE: How can we calculate Age of employee?

    t.hitendra (5/11/2009)


    Hi,

    you can try this

    select EMP_CODE,DATE_OF_BIRTH ,DATEDIFF(DD,DATE_OF_BIRTH,getdate())/365 as years,(DATEDIFF(DD,DATE_OF_BIRTH,getdate())%365)/30 as months,

    DATEDIFF(DD,DATE_OF_BIRTH,getdate())%365%30 as days

    from EMP_MST where accountid=4

    Hitendra

    Hi,

    create the function like

    CREATE FUNCTION AGE_ASOF_NOW (@EMP_DOB DATETIME,@curr_dt datetime)

    returns varchar(1000)

    AS

    BEGIN

    declare...

  • RE: How can we calculate Age of employee?

    Hi,

    Your output gives only the days,

    The age may come in the format of years months and days like 34 years 10Months and 15 days

    ARUN SAS

  • RE: PIVOT operator

    Hi,

    try this

    CREATE TABLE #tblAssessments

    (

    AssessmentID int IDENTITY(1,1) NOT NULL,

    UserID int NULL,

    AssessmentDate datetime NULL,

    FollowUpCall numeric(1, 0) NULL,

    HealthScore int NULL

    )

    insert into #tblAssessments (UserID,AssessmentDate,FollowUpCall,HealthScore)

    values (1, '04-May-2009', 1, 5)

    insert into #tblAssessments (UserID,AssessmentDate,FollowUpCall,HealthScore)

    values (1, '06-May-2009',...

  • RE: PIVOT operator

    Hi,

    Show some sample data with desired output.

    ARUN SAS

  • RE: Nearest multiple of 12

    Hi,

    try this

    declare @abc int

    select @abc = 125

    select @abc = 12*(round((@ABC/12),0) + (case when (cast(@ABC as int)%12)< 6.00 then 0 else 1 end))

    -- assume that nearest to 6

    select @abc

    ARUN SAS

  • RE: select clients with two billing currencies

    klanguedoc (5/6/2009)


    select distinct custno, currency, COUNT(currency) from tblSales

    group by custno, currency having currency = 'USD' or currency='CAD'

    order by custno

    Hi,

    from your codeing result for count of currency alwayes one,

    --only the customer...

  • RE: Dynamic decimal precision

    Hi Kishore,

    When the value like 1.23999

    Then it’s round the value

    Select @input = 1.23999, @precision = 4

    Result to 1.2400

    For that better...

  • RE: Problem with the Query

    Hi,

    try this

    declare @abc varchar(10)

    set @abc = '1234'

    select substring(@ABC,1,case when (charindex('+',@ABC)-1)< 0 then 0 else (charindex('+',@ABC)-1)end)

    select substring(@ABC,(charindex('+',@ABC)+1),(len(@ABC)))

    ARUN SAS

  • RE: Execute Multiple Exec Command in a string

    Hi,

    try this

    DECLARE @abc VARCHAR(1000)

    SELECT @abc = 'SELECT * FROM syssegments; SELECT * FROM sysconstraints;'

    select @abc = replace(@abc,';',' GO')

    exec (@abc)

    ARUN SAS

  • RE: Import job

    Hi,

    See the sysjobhistory table in the msdb,

    In run_status col shows the status of the job or steps

    ARUN SAS

  • RE: Get Column Values as Row val

    Hi suresh,

    Are you trying this?

    first try to bulid the coding, then show it

    ARUN SAS

  • RE: Problem with the Query

    Hi,

    your code is correct

    and try with close brackets

    update emp_data

    set firstname=substring(name,1,(charindex('+',name)-1)),

    lastname=substring(name,(charindex('+',name)+1),(len(name)))

    declare @abc varchar(10)

    set @abc = 'ABCD+1234'

    select substring(@ABC,1,(charindex('+',@ABC)-1))

    select substring(@ABC,(charindex('+',@ABC)+1),(len(@ABC)))

    ARUN SAS

Viewing 15 posts - 436 through 450 (of 569 total)