I was tried exporting data from SQL Server table to .csv file and for that, I'm using the BCP utility in a batch file. My requirement is to pass database name, filename and server name as arguments.
bcp %1.dbo.temp_raw_MSPsalesrecordExtract out \\192.168.17.95\NonProdData1\CMA\ChennaiDA\Selva\%2.csv -c -t"|" -S "%3" -T
while running got an error
C:\Users\selva\Desktop\Bat>bcp.bat selva_test testfile ind-server01
The input line is too long.
The syntax of the command is incorrect.
Could anyone help me on this?
Related
I am writing a shell script to run a sql select query using mysqlsh.
So I had some issues and I found that I need to use "\sql" to change it from
mysql-js> to mysql-sql>
I need to run /sql before I run the query from a file.
"C:\mysql-shell-1.0.11-windows-x86-64bit\bin\mysqlsh.exe" echo \sql | mysql://user#IP:PORT?schema=SCHEMANAME&password=PASSWORD
and then execute this to run the select query and save it to a tmpfile.txt
"C:\mysql-shell-1.0.11-windows-x86-64bit\bin\mysqlsh.exe" --file "$EDIR"/data/tmp.sql > "$EDIR"/data/tmpfile.txt 2>&1
I am not sure what am missing. I tried different alternatives,
I am getting the below error on the first line
"data_extractss.sh: line 53: mysql://user#IP:PORT?schema=SCHEMANAME&password=PASSWORD: No such file or directory"
Any suggestion is appreciated.
First, please upgrade to the latest version of the shell 8.0.12
Second, start the shell like 'mysqlsh --sql' or 'mysqlsh --sqlc' to have it start in SQL mode
I am trying to read a simple xls file with xlsread in octave. Its csv version is shown below:
2,4,6
8,10,12
14,16,18
20,22,24
I have run the following commands in octave:
# the next commands are to select the file through a gui.
# it reports a warning, but selects the filename correctly
>> pkg load io
>> fprintf('Select the training data file ... \n');
Select the training data file ...
>> filename = uigetfile({'*.xls'; '*.xlsx'}, 'File Selector');
Gtk-Message: 14:37:32.971: GtkDialog mapped without a transient parent. This is discouraged.
>> printf('file name %s\n', filename);
file name x1.xls
# now I am trying to read the xls, and I get an error:
>> [~, ~, RAW] = xlsread(filename);
Detected XLS interfaces: None.
warning: xlsopen.m: no '.xls' spreadsheet I/O support with available interfaces.
warning: xlsread: some elements in list of return values are undefined
warning: called from
xlsread at line 268 column 1
I am using octave-4.2.2 on ubuntu-18.04 LTS. What is the reason for this error? Is there any other package that I need to install? How do I fix this problem?
octave supports xlsx, not xls.
This is the code I have used to save my query result to csv file
hive -e 'select * from twitter.finalcount' > hdfs dfs /user/hue/resutsofquery/finalcount.csv
This is the output:
2017-03-18 07:27:40,810 WARN [main] mapreduce.TableMapReduceUtil: The hbase-prefix-tree module jar containing PrefixTreeCodec is not present. Continuing without it.
Logging initialized using configuration in file:/etc/hive/conf.dist/hive-log4j.properties
OK
**Time taken: 49.537 seconds, Fetched: 25363 row(s)**
But when I check my csv file it wasn't at my directory (resutsofquery). How do I find it? Provide me a good solution
I tried this way too
hive -e 'set hive.cli.print.header=true; SELECT * FROM twitter.finalcount LIMIT 0;' > /user/hue/resutsofquery/file_name.csv
But it throws an error
bash: /user/hue/resutsofquery/file_name.csv: No such file or directory
I types this in terminal
I am getting an error while importing a json document into mongoDB installed on my mac. I saw on another forum that the syntax is as follows:
mongoimport --db db1 --collection collection1 --file /Users/chummi/Desktop/zips.json
Here db1 is my database and collection1 is my collection and /Users/chummi/Desktop/zips.json is the path where the json document is present. When I run this command, am getting the following error
"SyntaxError: Unexpected identifier"
and not able to understand what this is.Please suggest if the syntax and the paths are correct?
Are you running mongoimport from inside the mongodb shell instead of the command line of your mac? Importing JSON file using mongimport, keep getting `unexpected identifier`?
I am new to database and have just started to learn MYSQL. I have downloaded a sql file called rating.sql and would like to import it to the MYSQL database installed on the local machine. The operation system is Windows 7. The path for the sql file is:
"E:\rating.sql".
I am using the following commands in the MySQL Command Line Client
mysql>use database_name;
mysql>source E:\rating.sql;
The system gives the following error message:
ERROR 1049 <42000>: Unknown database 'ating.sql'
It is definitely something related to the path. Can anyone explain how this error is generated?Thanks
You have use \ and this is an escape character (omits the immediate following character. So to fix this you can use \ instead.
mysql>resour E:\\rating.sql;
Mysql recognises \r as an escape for a carriage return character.
To make it simpler, could you rename your file to something beginning with another letter...mustn't be b n r t or z...