Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7168705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:50:00+00:00 2026-05-28T14:50:00+00:00

using SQL Server 2005 with SP4 and I am designing a database table. Here

  • 0

using SQL Server 2005 with SP4 and I am designing a database table.

Here is the table DDL

CREATE TABLE CPSync4D.ProjectProfilerOption
(
    ProjectProfilerOptionID     INT  IDENTITY(1,1) CONSTRAINT PK_ProjectProfilerOption_ProjectProfilerOptionID PRIMARY KEY 
   ,ProjectID                   INT  CONSTRAINT FK_ProjectProfilerOption_Project_ProjectID FOREIGN KEY(ProjectID) REFERENCES CPSync4D.Project(ProjectID) ON DELETE CASCADE
   ,ProfilerOptionID            TINYINT CONSTRAINT FK_ProjectProfilerOption_ProfilerOption_ProfilerOptionID  FOREIGN KEY(ProfilerOptionID) REFERENCES CPSync4D.ProfilerOption (ProfilerOptionID) 
   ,ProfilerOptionValue         sql_variant  NOT NULL   

)
Go

profileroptionvalue column can hold either a string upto 30 characters, integer or decimal values e.g. values are “ProfilerValueType”, or 12.52 or 20 etc. (no more than than two decimals and integer values are less than 100)

Should I use sql_variant or varchar(30)…? I never used sql_variant before and not sure any implication of not using in terms of database design.

Any pitfalls of using sql_variant…with .net code

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:50:01+00:00Added an answer on May 28, 2026 at 2:50 pm

    10 reasons to explicitly convert SQL Server data types

    As a general rule, you should avoid using SQL Server’s sql_variant
    data type. Besides being a memory hog, sql_variant is limited:

    • Variants can’t be part of a primary or foreign key. (this doesn’t hold as of SQL Server 2005. See update below)
    • Variants can’t be part of a computed column.
    • Variants won’t work with LIKE in a WHERE clause.
    • OLE DB and ODBC providers automatically convert variants to nvarchar(4000) — ouch!

    To avoid problems, always explicitly convert sql_variant data types as
    you use them. Use any method you please, just don’t try to work with
    an unconverted sql_variant data type.

    I haven’t used sql_variant before but with these restrictions and performance implications in mind, I would first look at alternatives.

    Following would be my most to least prefered solution

    • Simply create three different columns. 3 Different data types (should) mean 3 different ways of interpreting it both at the client side and server side.
    • If that is not an option, use a VARCHAR column so you can at least use LIKE statements.
    • Use the sql_variant data type.

    Edit Cudo’s to ta.speot.is

    Variants can be part of a primary of foreign key

    A unique, primary, or foreign key may include columns of type
    sql_variant, but the total length of the data values that make up the
    key of a specific row should not be more than the maximum length of an
    index. This is 900 bytes

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

[using SQL Server 2005] I have a table full of users, I want to
Using SQL Server 2005 and 2008. I've got a potentially very large table (potentially
I am using SQL Server 2005. I have a table with a text column
Using SQL Server 2005 I have a table with the following columns id name
Using Sql-Server 2005. I have Users table with 3 columns. userID, parentUserID and userEmail.
I am using sql server 2005 I have a table [say tblHistory] and this
Using SQL Server 2005 I want to generate the table values between the two
Using SQL Server 2005 I want to get only numeric values from the table
Using SQL Server 2005, I am working with a database which has two columns
Using SQL Server 2005 I have two table which have the same datatype and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.