Changing Datatypes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sandyboy
    New Member
    • May 2007
    • 16

    Changing Datatypes

    Hi All,

    I have a database that contains 25 tables. In these tables the character data was stored as nvarchar datatype. Since i am not using any unicode data and the space occupied by nvarchar is more , i want to change the datatype from nvarchar to varchar. I cannot do one by one since there are 25 tables and each table has atleast 10 columns of datatype nvarchar.

    How can i change the datatype from nvarchar to varchar in all the tables. Should i use any cursors or is there any other way. I am newbie to SQL server i dont know how to use cursors.

    Can u please guide me the steps to be followed to convert to varchar datatype.

    Thank you.
  • sandyboy
    New Member
    • May 2007
    • 16

    #2
    Hi All,

    I have a database that contains 25 tables. In these tables the character data was stored as nvarchar datatype. Since i am not using any unicode data and the space occupied by nvarchar is more , i want to change the datatype from nvarchar to varchar. I cannot do one by one since there are 25 tables and each table has atleast 10 columns of datatype nvarchar.

    How can i change the datatype from nvarchar to varchar in all the tables. Should i use any cursors or is there any other way. I am newbie to SQL server i dont know how to use cursors.

    Can u please guide me the steps to be followed to convert to varchar datatype.

    Thank you.

    Comment

    • sandyboy
      New Member
      • May 2007
      • 16

      #3
      Hi All,

      I have a database that contains 25 tables. In these tables the character data was stored as nvarchar datatype. Since i am not using any unicode data and the space occupied by nvarchar is more , i want to change the datatype from nvarchar to varchar. I cannot do one by one since there are 25 tables and each table has atleast 10 columns of datatype nvarchar.

      How can i change the datatype from nvarchar to varchar in all the tables. Should i use any cursors or is there any other way. I am newbie to SQL server i dont know how to use cursors.

      Can u please guide me the steps to be followed to convert to varchar datatype.

      Thank you.

      --------------------------------------------------------------------------------

      Reply

      Comment

      • Motoma
        Recognized Expert Specialist
        • Jan 2007
        • 3236

        #4
        Create a cursor that goes through all the tables in the databases, looking at the table structure, and altering as necessary.

        Comment

        • debasisdas
          Recognized Expert Expert
          • Dec 2006
          • 8119

          #5
          Originally posted by sandyboy
          Should i use any cursors or is there any other way. I am newbie to SQL server i dont know how to use cursors.
          You are saying to be a newbie to SQL server and dont know how to use cursors. and again u want to write cursors.

          U should know the fundaments first of all .

          And please don;t post the same question repeatedly.

          Please follow the posting guidelines before posting.

          consider it as first warning to you.

          Comment

          Working...