Forum Replies Created

Viewing 15 posts - 16 through 30 (of 74 total)

  • RE: Recursive CTE

    Hi,

    Sure.

    You have a Common Table Expression with one base query and two recursive queries, joined together by union all. The CTE is named CTE and have one column named x.

    I...

  • RE: I have forgot my sa password

    Hi,

    You don't need to reinstall anything!

    If you set the database in Single User Mode, you can change the password.

    To set the database in Single User Mode, when not knowing the...

  • RE: Matrix Report

    Hi,

    you should be able to change source for your report. So instead of using the Stored Procedure as is, you write a query using the Stored Procedure and join the...

  • RE: Matrix Report

    Hi,

    create a month-table and (left or right) join with that.

    I see that my query is not a perfect example, but since I have nothing else to go on I use...

  • RE: Matrix Report

    Hi Usharani,

    it's hard to show a complete solution, since you haven't posted any information about table layout, data etc. But usually you can do something like this:

    DECLARE @data...

  • RE: Getting the details of the rows into columns

    Hi Pawan,

    There is no way to have SQL Server to return sets with varying number of columns for the different rows.

    Normaly you would write a query like:

    SELECT T1.Requestid, T1.RequestorName, T2.ApproverName,...

  • RE: Arithmetic Overflow Error Converting Expression To Float

    Hi Robert,

    What type does [Max_Value] have?

    Is it possibly a float?

    Since you are comparing the (non-float) calculated value with [Max_Value] (possibly float), one of the values must change data-type for...

  • RE: Which index run first Clustered index or Non_Clustered index

    I guess you're asking which index the Query Optimizer will choose to use when you are querying the table?

    That depends on the query. The Optimizer will choose to use the...

  • RE: Is it possible to transform the data to xml file with specified format

    Hi kpao,

    I'm not sure how to get (if it is possible at all) numbered tag names (<Range1>, <Range2>, etc). If you are satisfied by getting the numbers as attributes instead...

  • RE: Discovering the Performance of a Query

    Hi,

    acording to the plan there is an index missing to solve the query efficient. You could try to add this index:

    CREATE INDEX IX_HTK_IK_LUK ON tblHolding

    ...

  • RE: Help with linked server query

    Hi,

    you can join a local table with a table. Either you can:

    SELECT *

    FROM LocalTable Local

    INNER JOIN MyLinkedServer.MyDatabase.MySchema.LinkedTable Linked

    ON Local.JoinField =...

  • RE: Convert a weird character string

    Hi,

    one way would be to parse the character string as a number by taking the ASCII value of the first character plus the ASCII value of the second character times...

  • RE: Convert date to UTC date

    Hi,

    To convert a datetime value to the format YYYY-MM-DD hh:mm:ss you write:

    declare @myDate datetime

    set @myDate = getdate()

    -- Convert date to string with format YYYY-MM-DD hh:mm:ss

    select CONVERT(char(19), @myDate, 120)

    Since you had...

  • RE: Trigger and XML

    Hi,

    you need something like this:

    CREATE TRIGGER td_EmployeesAudit ON dbo.Employees

    FOR INSERT, UPDATE, DELETE

    AS

    INSERT INTO EmployeesHistory (ChangedTable, ChangedBy, ChangedOn, Deleted, Changes)

    SELECT 'Employees', USER, getdate(), 1, <XML_Column_Name_In_Table_Employees>

    FROM DELETED

    INSERT INTO EmployeesHistory (ChangedTable, ChangedBy, ChangedOn,...

  • RE: Remove Extra Row

    Hi,

    just use GROUP BY in combination with MIN or MAX:

    declare @myTable table (ID int, Test varchar(200))

    insert into @myTable

    select 1, 'Tax Exempt' union all

    select 1, 'Tax Composition'

    SELECT ID, MAX(Test) -- or...

Viewing 15 posts - 16 through 30 (of 74 total)