Re: Trying to use a SELECT ...INTO Command with InterBase, Sybase, and Informix

From: Shawn Enderlin <senderli_at_holidayco.com>
Date: 1998/10/02
Message-ID: <36150E4B.F76917B5_at_holidayco.com>#1/1


If you are running on a Sybase database you will need to make sure that the 'select into/bulkcopy' option is turned on for the databse. To verify if this has been done do a sp_helpdb <db_name> and look in the options section. If it isn't set it will need to be done by sa or I think dbo can do it too.

If that isn't it then hopefully someone else will be of more help.



Shawn Enderlin, DBA
Holiday Companies

Peter DeSimone wrote:
>
> I am trying to run the following command:
>
> SELECT TSP_COMPONENTS.ID LEVEL0ID, TSP_COMPONENTS.NAME LEVEL0NAME,
> TSP_COMPONENTS.ABBREVIATION LEVEL0Abbreviation
> FROM TSP_COMPONENTS
> WHERE (((TSP_COMPONENTS.COMPONENT_LEVEL)=0))
> INTO Level_0
>
> I want to take the data from the SELECT…FROM…WHERE SQL Statement and put it
> into a new table called LEVEL_0. The Interactive SQL tool doesn’t like the
> INTO command. Everything else in that SQL statement works fine.
>
> This statement works fine in Access and SQL:
>
> SELECT TSP_COMPONENTS.ID AS LEVEL9ID, TSP_COMPONENTS.NAME AS LEVEL9NAME,
> TSP_COMPONENTS.ABBREVIATION AS LEVEL9Abbreviation INTO Level_9
> FROM TSP_COMPONENTS
> WHERE (((TSP_COMPONENTS.COMPONENT_LEVEL)=9))
>
> Any help would be appreciated.
>
> In the end I need the following script to work:
>
> DROP TABLE Level_0
> SELECT TSP_COMPONENTS.ID AS LEVEL0ID, TSP_COMPONENTS.NAME AS LEVEL0NAME,
> TSP_COMPONENTS.ABBREVIATION AS LEVEL0Abbreviation INTO Level_0
> FROM TSP_COMPONENTS
> WHERE (((TSP_COMPONENTS.COMPONENT_LEVEL)=0))
> DROP TABLE Level_1
> SELECT TSP_COMPONENTS.ID AS LEVEL1ID, TSP_COMPONENTS.NAME AS LEVEL1NAME,
> TSP_COMPONENTS.ABBREVIATION AS LEVEL1Abbreviation INTO Level_1
> FROM TSP_COMPONENTS
> WHERE (((TSP_COMPONENTS.COMPONENT_LEVEL)=1))
> DROP TABLE Level_2
> SELECT TSP_COMPONENTS.ID AS LEVEL2ID, TSP_COMPONENTS.NAME AS LEVEL2NAME,
> TSP_COMPONENTS.ABBREVIATION AS LEVEL2Abbreviation INTO Level_2
> FROM TSP_COMPONENTS
> WHERE (((TSP_COMPONENTS.COMPONENT_LEVEL)=2))
> DROP TABLE Level_3
> SELECT TSP_COMPONENTS.ID AS LEVEL3ID, TSP_COMPONENTS.NAME AS LEVEL3NAME,
> TSP_COMPONENTS.ABBREVIATION AS LEVEL3Abbreviation INTO Level_3
> FROM TSP_COMPONENTS
> WHERE (((TSP_COMPONENTS.COMPONENT_LEVEL)=3))
> DROP TABLE Level_4
> SELECT TSP_COMPONENTS.ID AS LEVEL4ID, TSP_COMPONENTS.NAME AS LEVEL4NAME,
> TSP_COMPONENTS.ABBREVIATION AS LEVEL4Abbreviation INTO Level_4
> FROM TSP_COMPONENTS
> WHERE (((TSP_COMPONENTS.COMPONENT_LEVEL)=4))
> DROP TABLE Level_5
> SELECT TSP_COMPONENTS.ID AS LEVEL5ID, TSP_COMPONENTS.NAME AS LEVEL5NAME,
> TSP_COMPONENTS.ABBREVIATION AS LEVEL5Abbreviation INTO Level_5
> FROM TSP_COMPONENTS
> WHERE (((TSP_COMPONENTS.COMPONENT_LEVEL)=5))
> DROP TABLE Level_6
> SELECT TSP_COMPONENTS.ID AS LEVEL6ID, TSP_COMPONENTS.NAME AS LEVEL6NAME,
> TSP_COMPONENTS.ABBREVIATION AS LEVEL6Abbreviation INTO Level_6
> FROM TSP_COMPONENTS
> WHERE (((TSP_COMPONENTS.COMPONENT_LEVEL)=6))
> DROP TABLE Level_7
> SELECT TSP_COMPONENTS.ID AS LEVEL7ID, TSP_COMPONENTS.NAME AS LEVEL7NAME,
> TSP_COMPONENTS.ABBREVIATION AS LEVEL7Abbreviation INTO Level_7
> FROM TSP_COMPONENTS
> WHERE (((TSP_COMPONENTS.COMPONENT_LEVEL)=7))
> DROP TABLE Level_8
> SELECT TSP_COMPONENTS.ID AS LEVEL8ID, TSP_COMPONENTS.NAME AS LEVEL8NAME,
> TSP_COMPONENTS.ABBREVIATION AS LEVEL8Abbreviation INTO Level_8
> FROM TSP_COMPONENTS
> WHERE (((TSP_COMPONENTS.COMPONENT_LEVEL)=8))
> DROP TABLE Level_9
> SELECT TSP_COMPONENTS.ID AS LEVEL9ID, TSP_COMPONENTS.NAME AS LEVEL9NAME,
> TSP_COMPONENTS.ABBREVIATION AS LEVEL9Abbreviation INTO Level_9
> FROM TSP_COMPONENTS
> WHERE (((TSP_COMPONENTS.COMPONENT_LEVEL)=9))
>
> Peter DeSimone
> pdesimone_at_sageus.com
  Received on Fri Oct 02 1998 - 00:00:00 CEST

Original text of this message