Can a field name be constructed, and if so, how?
For example;
Declare @.Date SmallDateTime
Set @.Date = GetDate()
I would like to create a field called 2005_Sales in a temp table
called 2005_Sales by constructing it from:
Convert( char(4), year( @.Date) ) + '_Sales'
If a field can not be created can a field be aliased by the same
construction?
Any help would be appreciated.>> Any help would be appreciated. <<
You are supposed to know to know what a thing is before you do it.
Even more basic, a field is NOT ANYTHING WHATSOEVER like a column.
You are trying to mimic a 1950's file system report in SQL.
Please, please, please learn the basics of data modeling before you
kill people or bankrupt companies. This is the kidn of thing which you
woudl learn in the first two days of a course.
Tuesday, February 14, 2012
Constructing a field name
Labels:
constructed,
constructing,
create,
database,
date,
exampledeclare,
field,
getdate,
howfor,
microsoft,
mysql,
oracle,
server,
smalldatetimeset,
sql
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment