I am attempting to setup a full text search catalog in SQL Server 2008 is there a way to make this catalog contain data from multiple tables?
In SSMS, you can select as many tables as fields as you like. They just have to be all in the same database.
Related
Here's the basic idea of what I want to do in SSIS:
I have a large query against a production Oracle database, and I need the following where clause that brings in a long list of ids from SQL Server. From there, the results are sent elsewhere.
select ...
from Oracle_table(s) --multi-join
where id in ([select distinct id from SQL_SERVER_table])
Alternatively, I could write the query this way:
select ...
from Oracle_table(s) --multi-join
...
join SQL_SERVER_table sst on sst.ID = Oracle_table.ID
Here are my limitations:
The Oracle query is large and cannot be run without the where id in (... clause
This means I cannot run the Oracle query, then join it against the ids in another step. I tried this, and the DBA's killed the temp table after it became 3 TB in size.
I have 160k id's
This means it is not practical to iterate through the id's one by one. In the past, I have run against ~1000 IDs, using a comma-separated list. It runs relatively fast - a few minutes.
The main query is in Oracle, but the ids are in SQL Server
I do not have the ability to write to Oracle
I've found many questions like this.
None of the answers I have found have a solution to my limitations.
Similar question:
Query a database based on result of query from another database
To prevent loading all rows from the Oracle table. The only way is to apply the filter in the Oracle database engine. I don't think this can be achieved using SSIS since you have more than 160000 ids in the SQL Server table, which cannot be efficiently loaded and passed to the Oracle SQL command:
Using Lookups and Merge Join will require loading all data from the Oracle database
Retrieving data from SQL Server, building a comma-separated string, and passing it to the Oracle SQL command cannot be done with too many IDs (160K).
The same issue using a Script Task.
Creating a Linked Server in SQL Server and Joining both tables will load all data from the Oracle database.
To solve your problem, you should search for a way to create a link to the SQL Server database from the Oracle engine.
Oracle Heterogenous Services
I don't have much experience in Oracle databases. Still, after a small research, I found something in Oracle equivalent to "Linked Servers" in SQL Server called "heterogeneous connectivity".
The query syntax should look like this:
select *
from Oracle_table
where id in (select distinct id from SQL_SERVER_table#sqlserverdsn)
You can refer to the following step-by-step guides to read more on how to connect to SQL Server tables from Oracle:
What is Oracle equivalent for Linked Server and can you join with SQL Server?
Making a Connection from Oracle to SQL Server - 1
Making a Connection from Oracle to SQL Server - 2
Heterogeneous Database connections - Oracle to SQL Server
Importing Data from SQL Server to a staging table in Oracle
Another approach is to use a Data Flow Task that imports IDs from SQL Server to a staging table in Oracle. Then use the staging table in your Oracle query. It would be better to create an index on the staging table. (If you do not have permission to write to the Oracle database, try to get permission to a separate staging database.)
Example of exporting data from SQL Server to Oracle:
Export SQL Server Data to Oracle using SSIS
Minimizing the data load from the Oracle table
If none of the solutions above solves your issue. You can try minimizing the data loaded from the Oracle database as much as possible.
As an example, you can try to get the Minimum and Maximum IDs from the SQL Server table, store both values within two variables. Then, you can use both variables in the SQL Command that loads the data from the Oracle table, like the following:
SELECT * FROM Oracle_Table WHERE ID > #MinID and ID < #MaxID
This will remove a bunch of useless data in your operation. In case your ID column is a string, you can use other measures to filter data, such as the string length, the first character.
I discovered the new tables dbo.geometry_columns and dbo.spatial_ref_sys in my SQL database (see image). It looks like they have been automatically created as I did not do it on purpose. I assume that it is caused by me having created some columns of type geometry in some tables and views. Are these automatically created tables which are mandatory for operation with columns of type geometry?
I am using "Microsoft SQL Server 2017" with "SQL Server Management Studio v18.4" on "Windows Server 2012 R2 Standard 6.3".
From https://alastaira.wordpress.com/ogr2ogr-patterns-for-sql-server/
"After importing any data, OGR2OGR will create two additional tables in your SQL Server database – spatial_ref_sys and geometry_columns, which store metadata about the spatial columns in the tables. These tables can be safely ignored (or deleted) – OGR2OGR will recreate them after each conversion anyway"
I am working with SQL Server 2008 R2.
I have a source database and a destination database.
In source database I have a table named rule_attribute which have 2 indexes.
This table does not exist in destination database.
I ran the SQL Server Export Wizard to copy this table from source database to destination database.
The wizard ran successfully and the table was copied to destination database along with data. But the 2 indexes on this table were not created.
Is there any reason why indexes were not created?
Is there any setting which allows to create indexes as part of wizard?
Thanks
The Import/Export wizard doesn't allow copying indexes, but if you use the Database Scripting tool it will allow you to add indexes in the scripts.
I'm new to SQL Server and today I began writing an SQL query. While writing SQL queries in SSMS (SQL Server Management Studio) for insert statements, I noticed that only table names were getting auto completed, but there is no option to auto complete the column name. Is there any way to autocomplete column names in a query?
INSERT INTO table_name (column1,column2,column3,...)
/* Here table name is auto completed. When i type a,a related tables were generated, but for columns there is no autocomplete. */
VALUES (value1,value2,value3,...);
Assuming you are using SQL Server Management Studio (SSMS), which most use people use when working with SQL Server, there is a weaker built in Intellisense that will fill in certain parts of SQL queries for you. If you want something stronger, you can check out third party addins. The most popular are probably SQL Prompt by Red Gate and SQL Complete by dbForge.
I have a database with regular full-text catalogs. I want to detach this database, copy it to a different server and attach it under a different name (same name but with '_BAK' appended to it). I am using SQL Server 2005.
Here is the error trying to attach DATABASE with full-text catalogs under the name DATABASE_BAK
Warning: Identity or last population complete time of full-text catalog in
directory 'E:\DATABASE\Name_FullText' does not match database 'DATABASE'.
The full-text catalog cannot be attached.
Is there a way to attach a database w/ full-text under a different name?
If not what other options do I have?
Attach without fulltext?
Drop the full-text at detach and recreate it?
Why not just attach the database and then rename it once attached?