User Profile

Collapse

Profile Sidebar

Collapse
Brad Orders
Brad Orders
Last Activity: Jul 1 '10, 02:05 AM
Joined: Feb 23 '08
Location: Melbourne, Australia
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Hi sanndeb

    There are a few possible ways of doing this. Here is what I would do:
    1. Get the unique Group IDs into a temporary table
    2. Use this temporary table with the original table to generate the XML.

    Here is the code I wrote to create the XML:

    -- Create a temp table with the Group Ids
    SELECT DISTINCT GroupId
    INTO #tmpGroups
    FROM #EmployeeTable

    -- Generate the...
    See more | Go to post

    Leave a comment:


  • Hi santhanalakshmi

    Hmm, not much to go on here. I would suggest that you make sure that your version of XP will support SQL Server 2008.

    If you have something like Windows XP Professional SP2 x64, you should be fine. If you have an Itanium processor, you should double-check it is supported.

    Kind regards


    Brad Orders...
    See more | Go to post

    Leave a comment:


  • Hi Ginny28

    Here is some example code for tackling your problem.
    This is what I use as a starting point whenever I am working on the type of problem you are describing.

    Hope it helps!

    Kind regards


    Brad



    declare @TestData Table
    (
    RecordId INT IDENTITY(1,1),
    STUDENT_ID VARCHAR(6),
    TF Decimal(2,1)
    )
    ...
    See more | Go to post

    Leave a comment:


  • Brad Orders
    replied to new creation date on 2 tables
    This is a tricky one. If access to a table is locked up and requires a restart of the SQL Service, then this isn't a run-of-the-mill issue.

    I would suggest backing up the database, then reviewing all triggers in the database, especially any added recently.

    Is there a job that is scheduled to run at that time? If so, review the code in the job.

    Just to cover all bases, check some varchar/nvarchar column values...
    See more | Go to post

    Leave a comment:


  • Hi romiverma

    Try replacing all single quotes with two single quotes.

    (eg. ' becomes '').

    Hope this helps.

    Brad Orders
    See more | Go to post

    Leave a comment:


  • Dynamic SQL in an INSTEAD OF trigger causes recursion

    Hi all

    Here is my situation:

    When table A is updated, I need to record some data in table B, then apply the update to table A

    Normally I would use a FOR UPDATE trigger, but the table has a TEXT field in it. Therefore, I must use an INSTEAD OF trigger.

    Columns may be added to this table without my knowledge or control, and without warning.

    Here is the approach I took inside...
    See more | Go to post

  • I would suggest that the approach that you take will depend on what you want to do with the data. If you are wanting to only return one month at a time (for example, the user provides a month and you return all the records for the month), then you could query the table, order by Transactions DESC, and put this into a temporary table that has a auto increment. Then you could SELECT the temp table, and the increment would give you the number you...
    See more | Go to post

    Leave a comment:


  • You could also consider putting the values inside the "IN" statement in their own table. Then you could solve the problem by doing a simple join, and order by the identity ID in the new table.

    If performance is important, this is a solution worth considering.
    See more | Go to post

    Leave a comment:


  • Brad Orders
    replied to Updating selected options Logic
    Assuming that you want a user to have many profiles, there is more than one way to do this.

    One:
    The user presses "Save", and their information is deleted from the database, and the new information saved. This is the option you have mentioned.

    Two:
    The user presses "Save". The code (eg .NET) checks for profiles that have been marked as "Delete", and deletes them. The code...
    See more | Go to post

    Leave a comment:


  • Brad Orders
    replied to Functions
    Hi Sonia

    If you are using SQL Server 2005, you do it by expanding Databases, {Database Name}, Programmability , Functions.

    Hope this helps.
    See more | Go to post

    Leave a comment:


  • Also, take care if you are using the URL:
    http://server/webapp/Default.aspx?cu stomerid=xx

    You will need to make sure that one customer cannot impersonate another customer by simply changing the customerid in the URL. This will need to happen on every page in the web app - not just the page after login.

    I agree that the customer should provide a password as well as their id. If security of the database is also...
    See more | Go to post

    Leave a comment:


  • The most efficient way would be to do this at the code level rather than the database level. Doing this kind of query at the database level will be slow and can be a bit messy.

    If you are using .NET, you could the stringbuilder object, and loop through the results from the database.

    HTH.
    See more | Go to post

    Leave a comment:


  • Brad Orders
    replied to intersect & except
    Hi Thesti

    I am assuming you want to work this out in SQL Server and not .NET...

    Here is the approach I would take:
    Assuming I had TableA and TableB. I want to find out all the records in TableA that aren't in TableB, based on a column RecordId. First step, find out all the records in TableA that ARE in TableB:

    Code:
    SELECT a.RecordId
    FROM TableA a
    INNER JOIN TableB b
    ON
    ...
    See more | Go to post

    Leave a comment:


  • Brad Orders
    replied to Dynamic Union of Tables
    Hi MasterBlaster

    With the tables you have at the moment, the easiest solution is to use the C# approach suggested. However, I would suggest that, if possible, you look into changing your tables so that you have a "DateEntere d" column. Then you don't have to change the database schema every month, and the query becomes a simple "BETWEEN" statement.

    HTH
    See more | Go to post

    Leave a comment:


  • Hi SonySunny

    It sounds like you have a scope issue. If you always call the second stored procedure after the first stored procedure, then you should call the second stored procedure from within the first stored procedure using the "EXEC" command. Then the second stored procedure will be able to "see" the temporary table.

    However, if the first and second stored procedures do not always follow each...
    See more | Go to post

    Leave a comment:


  • Brad Orders
    replied to Dataset question?
    in .NET
    Hi Pawan

    When you said "I have to insert the value of this dataset to a table", did you mean a database table? If so, are you (1) trying to update the databases with changes made by the user, or (2) are you transferring data from one table to another?

    If (1), then only update the rows that have been changed. If (2), try transferring the data from within SQL Server, and try and avoid sending the data via ...
    See more | Go to post

    Leave a comment:


  • Brad Orders
    replied to calculate score in ms sql
    I'm not sure, but is this the kind of thing you are after?

    Code:
    SELECT C1
    FROM TableName
    WHERE C1 = @SomeParameter
    ORDER BY C2, C3, C4
    If you want to order the results by a column in descending order, just put DESC after the column name (eg. "C2 DESC")

    HTH.
    See more | Go to post

    Leave a comment:


  • Brad Orders
    replied to Sorting on GridView
    in .NET
    I would suggest sorting the DataSet or DataTable before setting it as the DataSource.

    Personally, I try and do any sorting as close as possible to the data. So if it is from a database, I would generally sort in the Stored Procedure, and so I avoid having to deal with this problem.

    HTH. If you are still having a problem, please post some code.

    Good luck
    See more | Go to post

    Leave a comment:


  • Brad Orders
    replied to create new excel
    in .NET
    Hi Yogarajan

    There are a number of ways you can do this, ranging from simple to painful. If you are just using a Datagrid, then one simple and quick way to display it in Excel is just change the content type like this:

    Code:
    Response.ContentType = "application/vnd.ms-excel"
    However, you will need to make sure that the HTML in the page is clean and really simple. I would suggest making...
    See more | Go to post

    Leave a comment:


  • Yes, I agree with Jagged. You can use his script to simulate the answer you want, but you really, really should change your table structures if at all possible. Your efforts now will save you a lot of work in the future. Good luck.
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...