Link to home
Create AccountLog in
Avatar of mikeydk
mikeydkFlag for Denmark

asked on

SQL Query rename/update

Hey

I have this query (SQL)

Select PackageID, Name, Version, Manufacturer, Language, Description,
PkgSourcePath , LastRefreshTime,
(SELECT COUNT(PkgID) FROM vPkgStatusSummaryDistPts WHERE PkgID = v_Package.PackageID) AS [No of DP]
FROM v_Package
WHERE
PackageID NOT IN (SELECT PackageID FROM v_Advertisement) AND
PackageID NOT IN (SELECT ReferencePackageID FROM v_TaskSequenceReferencesInfo) AND
PackageType = 0 AND
ORDER BY Name

....

How to I make the query rename all "Name" in the result to "OLD_Name"? (add "OLD_" to the record).

Thanks in advance.

Mike
Avatar of skarai
skarai
Flag of United States of America image

Use this syntax where you specify what the source column should appear as in your result set.

Select
PackageID
, Name AS OLD_Name
, Version, Manufacturer, Language, Description,
PkgSourcePath , LastRefreshTime, ...
ASKER CERTIFIED SOLUTION
Avatar of jvejskrab
jvejskrab
Flag of Czechia image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.