Using Drag-and-Drop

When you use drag-and-drop to compose SQL/XML, you start by selecting an object (a table or a column, for example) from the database schema tree and dragging it to the SQL/XML editor. When you drop the object (by releasing the mouse button) on the editor, Stylus Studio displays a shortcut menu of choices for that object. These include

  • The object name, in both unqualified and qualified formats ( authors and dbo.authors, for example). The format you choose depends on the database you are using - some databases require qualified names, for example. You might want to use this feature to add object names to an SQL/XML statement without typing them.
  • A complete SELECT statement (if you are on the editor's SELECT tab); Stylus Studio uses the object name you selected to complete the statement.
  • A complete INSERT, UPDATE, or SELECT statement (if you are on the editor's UPDATE tab); Stylus Studio uses the object name you selected to complete the statement.

Example

Following is an example of the INSERT statement Stylus Studio creates using the publishers table:

INSERT xml_document(?)
               
 
               
INTO dbo.publishers (pub_id,pub_name,city,state,country)
               
 
               
xml_row_pattern('/root/row')
               
 
               
VALUES(
               
	xml_xpath('pub_id/text()','CHAR'),
               
	xml_xpath('pub_name/text()','VARCHAR'),
               
	xml_xpath('city/text()','VARCHAR'),
               
	xml_xpath('state/text()','CHAR'),
               
	xml_xpath('country/text()','VARCHAR'))
               

            

 
Free Stylus Studio XML Training: