queries

  • Hi,

    How to do the following:

    1. Is there any way of getting a row size from a data table in the database.

    for example I have a "Employee" table in the database called "Company" and many rows are populated into the table,  and now I need the number of bytes a particular row has occupied in the table.

    2. Suppose I want to add new columns in the existing table, then is there any possibility of adding the column in the middle of the table and not at the end?

    ex. Employee table contains c1,c2 and c3 ( in the same order) now is it possible to add c4 in between c1 and c2?

    Thnx in advance,

    Natalie.

     

     

  • 2. Yes, but it's not worth it. Enterprise Manager makes it easy, but it's really:

    Make a new table with the columns in the order you want.

    Copy the data from the old table to the new table.

    Drop the old table.

    Rename the new table to the old table's name.

    -SQLBill

  • A rough approximation of the number of bytes for a row can be had by: select datalength(col1) + datalength(col2) + ....

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply