Trying to Determine What a Declared Variable Will Return

I was given this scenario, and need to determine what a specific declared variable would return:

Table:  Employees
ID int not null
F_Name varchar(50) not null
L_Name varchar(100) not null

DECLARE @ColumnName varchar(255)
SET @ColumnName = "

SET @ColumnName = 
         (
              SELECT MIN(QUOTENAME(COLUMN_NAME))
                    FROM Information_Schema.Columns
                      WHERE Table_Name = "Employees"
                          AND Data_Type IN ('char','varchar','nchar','nvarchar')
         )


Will it return ID, F_Name, L_Name or will it return an Error?

Thanks,

gdunn59

Open in new window

LVL 1
gdunn59Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TONY TAYLORCommented:
This is a quiz question and has been reported.
gdunn59Author Commented:
Tony,

I am 56 years old and I am not in school.  I just came across a workbook that I had years ago from a previous job that my boss supplied to me.  I was going over some of the SQL Statements in this book and trying to familiarize myself with more advanced SQL Statements that I was not familiar with.
Scott PletcherSenior DBACommented:
Can't you install a free version of SQL Express and just run the statement and see what it returns?
gdunn59Author Commented:
Scott,

I did run it and it executes fine with no errors, but it doesn't show the results.

How can I see the results?

Thanks,

gdunn59
TONY TAYLORCommented:
The quiz question is #22 at:
http://forum.iwethey.org/forum/post/400999/

You obtain the answer by the following code:
SELECT @ColumnName

Open in new window


But you should not use EE to answer your questions for you.  Rather ask how to come up with the answers yourself.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.