Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Datatype column type in SQL Server 2000

Datatype column type in SQL Server 2000

Scheduled Pinned Locked Moved Database
databasesql-serversysadmintutorialquestion
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Senthil_M
    wrote on last edited by
    #1

    Hi all, Is there a datatype "column" in SQL SERver 2000? If not can we generate user-defined datatype as "column"? How to convert a variable to datatype column ? Please reply asap.. Senthil

    K 1 Reply Last reply
    0
    • S Senthil_M

      Hi all, Is there a datatype "column" in SQL SERver 2000? If not can we generate user-defined datatype as "column"? How to convert a variable to datatype column ? Please reply asap.. Senthil

      K Offline
      K Offline
      kubben
      wrote on last edited by
      #2

      What exactly do you mean by datatype column. Is this an object? If you are talking about saving objects in sql I would suggest you serialize the object into xml and save the xml in a text column. Ben

      S 1 Reply Last reply
      0
      • K kubben

        What exactly do you mean by datatype column. Is this an object? If you are talking about saving objects in sql I would suggest you serialize the object into xml and save the xml in a text column. Ben

        S Offline
        S Offline
        Senthil_M
        wrote on last edited by
        #3

        Hi, Thanks for your reply. I will give an example Declare @i int Set @i=1 while @i<=7 Begin Update set + @i = value End In the above example, column name will be dynamic , i.e., column1, column2. So, I want to use dynamic query for updation. As dynamic query will hit my performance,I need to avoid dynamic query. Is there any possible way for this? There is a datatype called table . Similar to that, whether there is any datatype called column? Senthil

        K 1 Reply Last reply
        0
        • S Senthil_M

          Hi, Thanks for your reply. I will give an example Declare @i int Set @i=1 while @i<=7 Begin Update set + @i = value End In the above example, column name will be dynamic , i.e., column1, column2. So, I want to use dynamic query for updation. As dynamic query will hit my performance,I need to avoid dynamic query. Is there any possible way for this? There is a datatype called table . Similar to that, whether there is any datatype called column? Senthil

          K Offline
          K Offline
          kubben
          wrote on last edited by
          #4

          Certainly if your table doesn't have very much data I would look at doing this in memory. If you are using .net there is a DataTable which you can dynamically create. There are DataColumns which you can dynamically add to the dataTable. Then you can take the devaultview of the datatable and use the rowfilter to query the table's data. In sql 2000 and 2005 there are table variables, but they only stick around for the duration of the stored procedure so you probably want it to be around a little longer then that. If there aren't too many rows and columns I would think seriously of keeping the data in an internal table in your program. Ben

          S 1 Reply Last reply
          0
          • K kubben

            Certainly if your table doesn't have very much data I would look at doing this in memory. If you are using .net there is a DataTable which you can dynamically create. There are DataColumns which you can dynamically add to the dataTable. Then you can take the devaultview of the datatable and use the rowfilter to query the table's data. In sql 2000 and 2005 there are table variables, but they only stick around for the duration of the stored procedure so you probably want it to be around a little longer then that. If there aren't too many rows and columns I would think seriously of keeping the data in an internal table in your program. Ben

            S Offline
            S Offline
            Senthil_M
            wrote on last edited by
            #5

            I am using such type of query in a stored procedure. My stored procedure is compiled each time when it is executed. I am in a position to remove those dynamic queries to get my stored procedure execute faster. I hope u understood. If not I can explain some more. Senthil

            K 1 Reply Last reply
            0
            • S Senthil_M

              I am using such type of query in a stored procedure. My stored procedure is compiled each time when it is executed. I am in a position to remove those dynamic queries to get my stored procedure execute faster. I hope u understood. If not I can explain some more. Senthil

              K Offline
              K Offline
              kubben
              wrote on last edited by
              #6

              Perhaps it would be better to explain exactly what you are trying to do. Why do you need a dynamic query? Why do you need to create a table? If you dynamic query returns certain columns you can just return those columns in the result set and your program can read them. The only issue because how your program knows what to do with the columns. Ben

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups