|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: 2 days ago @ 9:50 AM
Points: 2,019,
Visits: 4,923
|
|
Like others I didn’t know what to answer. I know that FROM clause can be used in an update statement, but I also noticed that the way that the example was written, it shouldn’t work. I decided to ignore the example and give the correct answer for the question only, but I can understand why many users wrote no because of the example.
Adi
-------------------------------------------------------------- To know how to ask questions and increase the chances of getting asnwers: http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Tuesday, May 29, 2012 2:50 AM
Points: 190,
Visits: 88
|
|
skjoldtc (9/24/2009) A suggestion for future questions. Maybe not all questions need sample code.
Although some questions very well could be written without sample code I think it is generally a good idea to have code along with a T-SQL question like this. But - the code should be correct, unless the purpose of the question is to spot the error.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Wednesday, June 27, 2012 7:28 AM
Points: 18,
Visits: 46
|
|
I answered no because the code does not work. Oh, well!
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Tuesday, April 02, 2013 8:43 PM
Points: 729,
Visits: 400
|
|
My apology guys.
The example provided makes the question confusing.
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Wednesday, January 02, 2013 11:41 AM
Points: 96,
Visits: 75
|
|
I too answered 'no' based upon the example...perhaps the example shouldn't have been given and just the question asked, but if you ran the given statement, it would certainly fail due to:
update table <-- [table] set a1.coulmn=a2.column <-- COULMN [misspelled] from table1 as a1, table2 as a2 where a1.colum1 = a2.column2 <-- COLUM [misspelled]
Was this ever QA'd? If I was handed this script to apply to production, I wouldn't have to see it fail to kick it back to the author and tell them to clean it up...
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Yesterday @ 8:24 AM
Points: 3,399,
Visits: 3,408
|
|
Aditya Kota (9/24/2009) My apology guys.
The example provided makes the question confusing.
Otherwhise it was a good question though.
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Friday, September 25, 2009 1:43 PM
Points: 4,
Visits: 15
|
|
I almost answered No based on the example even though I use FROM in UPDATE statements all the time. I echo the earlier the suggestions that some questions are better off without a poorly written example.
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 2:04 PM
Points: 201,
Visits: 179
|
|
I know that the intended database environment for this question was SQL Server so the answer is yes, however if running T-SQL against an Access database, the answer is no. To me technically, the correct answer is 'depends' yes. (Corrected) I just did the research and discovered that T-SQL is SQL Server specific. Access uses JET SQL. I maintain applications that can run against either sql server or access and share 95% of the sql statements. Update queries against joined tables is one area that I have to be specific to the target database.
|
|
|
|
|
Say Hey Kid
      
Group: General Forum Members
Last Login: Monday, March 11, 2013 4:12 AM
Points: 664,
Visits: 138
|
|
Yes and we can use all the DML operation while updation
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Friday, February 04, 2011 7:20 AM
Points: 977,
Visits: 1,499
|
|
amit_adarsh (9/24/2009)
Yes and we can use all the DML operation while updation
I think you meant to say updationing.
Tom Garth Vertical Solutions
"There are three kinds of men. The one that learns by reading. The few who learn by observation. The rest of them have to pee on the electric fence for themselves." -- Will Rogers
|
|
|
|