Add values to a Multiple Metadata column via SQL - sharepoint

I am trying to add multiple values to a multiple metadata column via SQL using a third party migration tool (Layer 2), but it only works when I add one value as explained below.
I have written some testing code like this in SQL
Select …
,'Qualifications;BA'
From
(Where Qualifications is the termset and BA and BSc are the terms)
And it works with just the one value with the SQL shown above.
However, I want this
To try to do this, I have amended the SQL like so
,'Qualifications;BA;BSC'
,'Qualifications;BA; Qualifications;Bsc '
,'Qualifications;[BA];[BSC]'
But sharepoint does not attempt the format and wont add any values
The error I get back from the software is
Does anyone know what the SQL should be to make this work, if possible?
Thanks

Add a pipe e.g. '|' to the list
'Qualifications;BSc|BA'

Related

SSIS Feed Account Numbers From Excel File as Criteria

hoping to be guided in the right direction with this.
I have an Excel sheet with about 7,900 account numbers. I need to feed those account numbers into a SQL query to pull data on those accounts. I would normally be able to just import that into a SQL server but I don't have access to this server to bring the data in for use. I'm having to do this through SSIS.
Is there a way to have SSIS read each row for the account numbers and feed them into my query as a variable?
I haven't tried anything with this yet as this would be the first time trying something like this in SSIS.
2 different ways to solve your problem:
Process 1. 7900 queries. You would use this approach if you are preparing statements for each account number or something like that.
Read excel file into a record set. Create package variable of type object. Excel Source => Recordset destination. This is done in a dataflow.
Add a foreach and choose ADO as to what iterate over and add your object variable.
Inside foreach object add a function object and build your SQL statement using the account number being iterated through.
Add a dataflow to run your sql and do something with the results.
Process 2. all account numbers at the same time. You would do this if you were just getting data back for analysis. This is a much faster way to get results.
Load the Excel account numbers into a staging table.
Inner Join that staging table into your query to get all results in one response.

Dynamic content for additional column with copy activity

I'm trying to create a simple copy activity to copy data from a source Azure Table to a sink Mongo Cosmos DB but want to also output an extra column to the sink data where the content of the additional column is the run id (or something else that is dynamically set per run).
I can add the extra column easily by defining an additional column in the source schema but can't work out how to set the content (presumably it should be set in the activity), hence the value for the added field is always NULL in the output DB
Thanks
You can do the same, or something similar, and create a Dynamic select statement in your copy activity. So something like SELECT #{item().sourceTableCustomColumnList}, #pipeline().RunId FROM #{item().sourceTableName}
You may refer the MSDN thread which addressing similar issue.
Hope this helps.

Spreadsheet with relationships

I have to work with data CSV file. They look like this
sample
It represents products with options/cars etc. at the web-store.
It has a lot of columns with duplicated values and in my work in often need to copy some part of this data to another sheet, deduplicate it, edit and then paste it back by matching it for one of the columns that were untouched. More this purpose I'm using Ablebits Excel suit.
Is it possible by any excel function to automate this process or maybe there is some other software that could handle this? Something not so complicated as relational databases like Access, but something close to spreadsheet editor with relationships
I already tried Power Query in Excel and Power Bi, but they seem to be more analytics tools and not the data edit
2nd edition:
Data has a layer structure with duplicates.
Title1|Part number 1|Car1
Title1|Part number 1|Car2
Title2|Part number 2|Option1
Title2|Part number 3|Option2
I want to have opportunity to:
Edit values that duplicate without using "Replace All" or at least have more flexible "Find&Replace".
Extract columns with deduplicating them and saving a reference to the place they were taken. So if you edit some data there it was changed in the 1st place. For example, I have titles(a lot of titles) but need to edit it. Instead of copying it with some id to reference it I want to open it like they appears in filters, edit it, confirm and get it edited in all column
I would use Power Query (aka Get & Transform on the Data ribbon in Excel 2016). The only limitation I see with what you want to do is that Power Query will deliver a new Excel Table with the output of a Query - it can't update existing cells.
If you can get past that, Power Query is very flexible, easy to learn (WYSIWYG query editor), scales well and is integrated with other Microsoft products (as well as Power BI, there is integration with SQL Server Analysis Services in preview and hopefully SQL Server Integration Services one day).

Insert the data from excel to table if data not already not existed, if existed the write to file in SSIS 2005

I'm new to SSIS. I'm trying to load the data from the excel to sql server table. What i have to do if the data already existed in the table then I have write it to a temp table or file if not existed then I have to insert into the table.
We are using sql server 2005. I'm using look up transformation to achieve that. But its not working. Is there any can I achieve it.
Please suggest me some tips. Your help greatly appreciated.
Regards,
VG.
I would write down the conceptual steps - as opposed to giving the step-by-step solution. This in my opinion be more helpful in developing the understanding. If you get stuck on any step, please let us know.
Step 1:
First of all load the file into a temporary table. You do not need to create the table manually; let BIDS create it for you. Alter the table to add a new column - ALREADY_EXISTS - BIT data type.
You would need to use Data Flow Task. Within it, use Excel data source and ADO destination.
Step 2a:
Write a sql statement in SSMS using inner join on your temp table and the final destination table. Make sure that the query you come up with gives the result you are expecting. Use this SELECT statement to UPDATE the ALREADY_EXISTS column inside the temp table.
Step 2:
Put Execute SQL task on the control surface. Use the query from Step 2.
Step 3:
Put another DFT on the control surface. Write a plain SELECT statement to pick up all columns - include the ALREADY_EXISTS.
Use a conditional split to determine new and existing records and point them accordingly to their destination.
Also, read up on Merge statement which is a feature introduced in SQL Server 2008.
Please share your experience with this solution.

Import a single Excel cell into SSIS

Am trying to import a number of metric values from an Excel file into SSIS.
I have named each of the cells with data and was hoping to be able to configure a Connection, that would be updated in a ForEach container, to point to each Named Range in turn, in order to bring over the data one value at a time.
I see many articles on how to connect to a Sheet or Table in Excel, but none to a Named Range? I saw one article on how to bring over one single cell, but that cell was a part of a table.
Can I setup a Connection in SSIS to a single cell, Named or otherwise, and bring back that value?
JK
I can see you implementing this in one of two ways. The first is just a straight Execute SQL Task that returns a single row. The other being a data flow with, probably a script task as your source.
With each pass through your loop, you'd probably need to modify the Excel connection manager and/or your query string to point to the correct named range
In the section To create a linked server against an Excel spreadsheet
To access data from an Excel spreadsheet, associate a range of cells
with a name. A named range can be accessed by using the name of the
range as the table name. The following query can be used to access a
named range called SalesData using the linked server set up in the
previous example.
This article also describes programmatically access Excel via C#, albeit from ASP.NET but the principal should be the same. My hazy recollection is that the worksheet name would have a $ appended to it, thus sheet1$ while accessing the named range would be without the $.
One thing we ran into with our implementation was our servers did not have the appropriate drivers on them and it required us to install the Access engine
Lots of generalities in this answer so if you run into specifics, feel free to ping me.
Take a look at the top two answers from this question:
Want to insert excel file data into table using ssis - format problem
which explains 2 different approaches to doing what you ask.
Here is how to do it http://www.mssqltips.com/sqlservertip/1930/use-ssis-to-import-one-cell-of-an-excel-file-into-sql-server/#comments.
Unfortunately it didn't help me because i want to set a single variable with the values and use it later on.

Resources