Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
anajjar
Starting Member
4 Posts |
Posted - 2013-12-10 : 21:15:12
|
Hello, I am down to my two last questions and having a lot of troubles with, please look over:-Create an updatable view named VendorAddress that returns the VendorID, both address columns, and the city, state, and zip code columns for each vendor. Then, write a SELECT query to examine the result set where VendorID=4. Next, write an UPDATE statement that changes the address so that the suite number (Ste 260) is stored in VendorAddress2 rather than in VendorAddress1. To verify the change, rerun your SELECT query.CREATE VIEW VendorAddressreturn VendorID, VendorAddress1, VendorAddress2, VendorState, VendorZip, VendorCitySELECT VendorID = 4UPDATE I THINK THE FIRST PART IS WRONG AND SECOND PART HAVE NO CLUE ABOUT??-Write a SELECT statement that selects all of the columns from the catalog view that returns information about foreign keys. How many foreign keys are defined in the APdatabase?SELECT * CatalogViewWHERENOT SURE HOW TO APPROACH THIS |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-12-11 : 05:23:46
|
it should be as below--Creating the view . i'm assuming the table name so put correct name belowCREATE VIEW VendorAddressASSELECT VendorID, VendorAddress1, VendorAddress2, VendorState, VendorZip, VendorCityFROM VendorTableGO--select query to examine resultsSELECT * FROM VendorAddress WHERE VendorID = 4--write an UPDATE statement that changes the address so that the suite number (Ste 260) is stored in VendorAddress2 rather than in VendorAddress1UPDATE VendorAddress SET VendorAddress2 = 'Ste 260',VendorAddress1 = REPLACE(VendorAddress1,'Ste 260','')WHERE VendorAddress1 LIKE '% Ste 260 %'for second part --Write a SELECT statement that selects all of the columns from the catalog view that returns information about foreign keysSELECT * FROM sys.foreign_keyshttp://technet.microsoft.com/en-us/library/ms189807.aspx--How many foreign keys are defined in the APdatabase?select * from AP.sys.foreign_keys ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
|
|
|
|
|