Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a (SQL Server) column which has a System Type but no Data Type (it is actually more then one) and this causes me problems when using the JDBC drivers on this column - it doesn't show up. I'm trying to understand what this means.

  • Can someone explain what the difference is between System Type and Data Type?
  • What does it mean that a column is missing a Data Type?

To create a Table which doesn't display a Data Type. This demands that you create a user which haven't read access to the user defined Data Types. This is how can reproduce it:

CREATE TYPE TEST_TYPE2 FROM [int] NOT NULL
GO
CREATE TABLE Customer
(
    CustomerID INT IDENTITY(1,1) NOT NULL,
    LastName    VARCHAR(100) NOT NULL,
    FirstName   VARCHAR(100) NOT NULL,
    ZIP         TEST_TYPE2 NOT NULL
)
GO
-- Create Table without UDDT
CREATE TABLE Customer_Orig
(
    CustomerID INT IDENTITY(1,1) NOT NULL,
    LastName    VARCHAR(100) NOT NULL,
    FirstName   VARCHAR(100) NOT NULL,
    ZIP         INT NOT NULL
)
GO

-- Create User with db_datareader to database
USE [master]
GO
CREATE LOGIN testUser WITH PASSWORD=N'THE_PASSWORD', 
 DEFAULT_DATABASE=[master], 
 CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO
USE TEST_DATABASE
GO
CREATE USER testUser FOR LOGIN testUser 
GO
USE TEST_DATABASE
GO
EXEC sp_addrolemember N'db_datareader', N'THE_PASSWORD'
GO
share|improve this question
    
What you're asking makes no sense. Please edit the question to include the DMV queries you're using, and ideally, screenshots of the results. – Jon Seigel Sep 16 '13 at 13:18
    
This can happen for example when you don't have read of custom types. Have a look here: mssqltips.com/sqlservertip/2983/… – giZm0 Sep 16 '13 at 13:28
    
So, the example in your question is just a copy from that link. Did you try the solution suggested there? – ypercubeᵀᴹ Sep 16 '13 at 13:34
    
I'm not asking for a solution I'm asking about System Type and Data Type. I'm not sure I fully understand it. The problem is that it works for odbc C# code, but not JDBC. So I have this code that doesn't work for some tables having this problem (I'm not 100% sure this is how it has happened but I can create a table having this problem with this code) and I try to understand as much as possible about what's wrong. Just that ODBC and JDBC have different behavior sounds fishy. – giZm0 Sep 16 '13 at 14:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.