cdemott33
asked on
Adding a default value to each row in a table variable
I've created a table variable and stored some value within it. There is a column in my table called "clientName" . Here what I need to do.
I need to set the clientName column to have the default value of 'Apple' for each row in my table.
How can I do this?
I need to set the clientName column to have the default value of 'Apple' for each row in my table.
How can I do this?
DECLARE @myTable table
(
myguid int identity(1,1),
clientName nvarchar(50),
transactionNumber int,
jobNumber nvarchar(500),
eventName nvarchar(500),
location nvarchar(500),
tier nvarchar(100),
movein datetime,
startdate datetime,
endtime datetime,
moveout datetime
)
INSERT INTO @myTable(
transactionNumber,
jobNumber,
eventName,
location,
tier,
movein,
startdate,
endtime,
moveout
)
SELECT
o.transactionNumber,
o.jobNumber,
o.eventName,
ei.location,
ei.tier,
o.shipToDeliveryDate,
ei.startDate,
ei.endDate,
ei.tearDownDate
FROM
onlineOrder AS o
INNER JOIN
eventInformation AS ei
ON o.jobNumber = ei.jobNumber
WHERE
(o.shipToDeliveryDate > '1/1/2012')
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER