essbase: How can i export without double quotes in data files using dataexport commands in MaxL? - essbase

i am exporting data from Essbase cubes using MAXL SET DATAEXPORT commands. But data file consists of double quotes to members.!
How can i export without double quotes in data files using dataexport commands in MaxL?

There is no option that I am aware of to turn this off. You want the quotes because it's possible to have a comma in a member name – if there were no quotes then member names with commas would really mess up the data load.
The question you should be asking yourself is seeing if the tool consuming the data file can work with the quotes. Most CSV readers handle this. If you really, really, really need to get rid of the double quotes then you might try using a stream editor like sed or even tr to remove them.
If you find this answer helpful please indicate as such so that more people are encouraged to answer Essbase questions!

Related

Searching for multuple valeus using REGEX

I have a big sporadic sql scripts and need to find and replace a few values in it. I am trying to pass my values in REGEX to Notepad++ but I can't seem to make it work. To be more specific, I have around 50 script, each with 5000 lines, and I need to look for a list of values, e.g. "[dbo].[livesales]" "[dbo].[CreditCards]" in all my scripts separately. I undertand that I need either run this separately against each script or merger them all into one file, but I need the proper REGEX command for it. I need to include square bracket and dots as well. I end up building this but it doesn't work for me:
^(?=.*\b[dbo].[LiveSales]\b)(?=.*\b[dbo].[CreditCards]\b).+$
enter image description here
thanks in advance,
I wouldn't bother using word boundaries, as square brackets in SQL Server are pretty ubiquitous for database object names (e.g. database and column names). I suggest the following pattern:
\[dbo\]\.\[(?:LiveSales|CreditCards)\]
Demo
The major changes I have made include not using word boundaries, escaping the [ and ] brackets (since square bracket is a regex metacharacter with a special meaning), and also not try to match the entire input. Presumably you want to find all such occurrences, and so don't bother trying to scope your pattern with ^ and $.

Escaping delimiter in BQ

I have a ton of files which are delimited by |, however, they have | as values in the fields as well. the | in the data has been escaped with \ but I don't think BQ is picking it up, is this something I can fix without having to open every single file, and updating? there are 2-3000 files and are all zipped, so doing it one by one is not at all practical.
Read each row as a whole line (CSV, with a weird character delimiter).
Parse in BigQuery - either via REGEX or JavaScript UDF.
I describe a similar approach here:
https://medium.com/google-cloud/bigquery-lazy-data-loading-ddl-dml-partitions-and-half-a-trillion-wikipedia-pageviews-cd3eacd657b6

Can you write a sql statement without spaces between keywords

I am trying to do SQL Injection testing but I am currently testing a command line that separates parameters by spaces, so I'm trying to write a sql statement without any spaces. I've gotten it down to:
create table"aab"("id"int,"notes"varchar(100))
But I cannot figure out how to get rid of the space between CREATE and TABLE. The same would apply obviously for DROP and TABLE, etc.
Does anyone have any ideas? This is for Microsoft SQL Server 2014. Thanks!
[Update]: We are evaluating a third party product for vulnerabilities. I am not doing this to test my own code for weaknesses.
You can write comments between lines instead of spaces in many cases. So /**/ instead of spaces.
Sure it is possible to write some pretty elaborate statements without spaces.
Here is one.
select'asdf'as[asdf]into[#MyTable]
You can even do things like execute sp_executesql without spaces.
exec[sp_executesql]N'select''asdf''as[asdf]into[#MyTable]'
This is not possible, you have to check every argument to make sure they are as intended.
If they are supposed to be numbers, make sure they are numbers, is they are supposed to be a string that may contain specific caracters (like ' or ,) you should escape them when executing the request.
There should be a dedicated mechanism in your programmation langage to take care of hat (like PreparedStatement in Java)
You can also using brackets () for every functions without spaces
SELECT(COUNT(id))FROM(users)where(id>5)

Getting long 'dirty' strings from SQL Server database into a 'clean' excel file

I Have a table in which comments are kept about clients. This is an open field and be very long and include line breaks.
When I try and export this to Excel, the data is misaligned. I'd like to return as much of the comment as possible in an excel cell, without anything like a line break.
Is there a way I could do this in Excel? (Find and replace)
Is there a way to structure my SQL query to only return what I can fit?
Or is there a better way?
I found the best way to deal with this is to enclose all suspect String columns with Speech marks "" and then in excel under the text to columns option make sure to select speech marks as a text qualifier.
This always worked for me.
Just be sure to remove speech marks from the string column in question otherwise it will split it again.
Another method i used was to used an obscure delimiter like an Ibar | which was not likely to be found in my data and by again using the Text to columns option i specified the IBar as the column separator which did just what i needed.
T

Have SQL SqlBulkCopy NOT remove leading spaces in column?

So Im using SqlBulkCopy to insert records into my database, but when doing so it is removing any leading spaces in my column. Is there a way for it not to do so? Please help!
You could try plaing double quotes around the values. That's what you do when you use bcp, SqlBulkCopy's great uncle. Not sure it'll work, though.
I have used SqlBulkCopy many times and have never encountered a scenario where the leading spaces were removed. In fact to achieve this I have had to explicitly find records with leading spaces and remove them.
Can you provide more information like the scenario in which you are encountering this please?
If your source is a text file and you are probably using an OleDb text driver, then the OleDb trims the spaces, therefore you might want to check if the spaces are being trimmed before its sent to SqlBulkCopy.