Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2010
    Posts
    3

    Unhappy Unanswered: help about some queries

    hii , i want know what is output of these queries and which ones have error and why?
    CREATE TABLE T1 (A INTEGER NOT NULL);
    CREATE TABLE T3 (A SMALLINT NOT NULL);
    INSERT T1 VALUES (32768.5);
    SELECT * FROM T1;
    INSERT T3 SELECT * FROM T1;
    SELECT * FROM T3;
    thanks

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    So what happened when you ran the queries? Then you will know the answer to your tutor's questions.

  3. #3
    Join Date
    Apr 2010
    Posts
    3
    Quote Originally Posted by pootle flump View Post
    So what happened when you ran the queries? Then you will know the answer to your tutor's questions.
    Unfortunately i don't have SQL SErver and i couldn't install it ,so i had to ask it here(i know that they must be run )plz guide me if u know them.

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    That is unfortunate.

    I'm afraid I'm not going to give you the answers. I can help you see if you can figure them out if you are willing to have a go. Otherwise you can speak with your tutor or a classmate about getting hold of an instance to run these on.

    Would you like to try to figure it out?

  5. #5
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    You could always get SQL Express, which is free, and should run on a desktop machine. It is not like you need the Enterprise features.

  6. #6
    Join Date
    Apr 2010
    Posts
    3
    Well first line create a table that has one column A.It's values must not be NULL. I think this can't has any error? Is my opinion correct?
    Second line create another table with one column A that it's values are SMALLINT.This line doesn't have any error too.I can't understand the exact meaning of ' NOT NULL ' here.

    Third line has error, since T1 table's data are integer.
    Line four also has no error and return all data of T1 ,but what are those?
    INSERT T3 SELECT * FROM T1; I think this line has error,since T1 table's data are integer (long and short integers) but T3 values are short integer,so maybe it create an error.

    Now can u plz help me and correct my wrong explanations.

    thanks a lot .
    Last edited by KAtrin; 04-30-10 at 11:27.

  7. #7
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Are you experiencing some kind of problem installing SQL Express through the link MCrowley provided above?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  8. #8
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Note MCrowley's advice is good - if you can install a copy of SQL Server it will help you lots, perhaps with future questions too. SQL Server Express is free.

    Good effort at guessing. You are correct about the first two lines.

    Third line - there is an implicit conversion. The effect is exactly the same as an explicit conversion. There is a numeric being converted to an integer. This is a link that describes what happens when a numeric is converted to an integer. You will have to hunt around a bit I'm afraid but I've given you enough information to find it reasonably easily.
    CAST and CONVERT (Transact-SQL)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •