SQL How can I convert MD5 Hash String to Binary using query? - sql

In my project, I have a user table where password is MD5 hashed and stored as binary(16). Now I want to write those user data as INSERT queries to a .sql file so that customer can import them back again?
Or is there anyway to export those data directly? I tried DTS using from Excel to Access file but when importing, there are several errors occur that I don't know why? Or is there any other tool besides MSSQL Server that can do this?
So far, now I'm using detach/attach the whole database to send to the customer which I think is not really a good way?
Thanks,

Someone posted an answer to my question and deleted it right away? He suggested me to use HASHBYTES which is exactly what I'm looking for. Thanks!

Related

SQL Server: Read data from URL Text File

I am looking for a way to read a data from URL and store it in a Table or a variable in SQL Server.
http://10.10.1.10/data/data.txt
The data in this URL will be like this 746473
The URL will have only one data at any point of time
Is it possible to capture this and store it against a variable or to a table. For guidance please.
It's possible but do you really want to open database in a such way?
Just read the data using another language like node.js or C# and call the T-SQL code then.
You can use use SSIS for such task or use some kind of CLR component. It's more complicated for sure then reading the data with node.js and inserting into a database.
I am advising to reconsider.

query XML file in a sql script

In HANA, I need information on calculation view like cross client or not, commentary on node, cardinality...
Those information are in XML file of the calculation view. Is it possible to extract it with a procedure?
During my research I found this : https://archive.sap.com/discussions/thread/3600091
I hoped that now it would be possible.
If you have any idea, please share with me,
Thanks in advance
I'm replying to the question on getting the metadata or attributes from a view. You can probably find these in tables like _sys_bi.bimc_* (e.g. BIMC_PROPERTIES in the _SYS_BI schema), SYS.VIEWS, SYS.VIEW_COLUMNS, SYS.cs_view_parameters (has the client as a parameter) or sys.view_columns.
I think it's easier to extract this information from the automatic documentation file in PDF format from HANA Studio, though, but it depends on what you are trying to do.

.SQL export from PHPMyAdmin to Excel or CSV

I inherited some old records for a company I volunteer for. One of the old files is an SQL Dump from their old webpage, and I would like to get the data from one of the tables for their use into Excel.
-- MySQL dump 10.11
The dump drops the table if it exists, creates the table new, and then inserts all of the data.
Is there some easy way I can get this data into Excel on my PC? I don't have SQL Server or anything like that loaded... I assumed there was some easy way to get a CSV or Excel file out of it but I have failed to find this yet without first uploading the dump to some SQL Server.
Unfortunately I don't think that there is any way to export a dump file into an excel or .CSV file. The reason for this is that the dump file is actually a collection of Select statements instead of the actual data itself. SQL servers do this to prevent a whole list of problems that can occur when you try to manipulate raw data manually.
Lucky for you, MySQL offers a free version of their server. You can find it here: http://dev.mysql.com/downloads/
I think you are best off downloading this and restoring your file as a new database. This has the added benefit of allowing you complete control over the data from that point on. Exporting to excel would be easy at that point however, you may find it a lot more fulfilling to continue using MySQL server.
Hope this helped.

can't see tables in SQuirrel

I am using a HSQL driver to connect to my database. I am able to connect without any errors but I can't see any of my tables in the table tree under public. I am able to create new tables which do appear, but I can't see the already created ones. Also when I check the .script file I can't see the new tables. Something strange is going on but I can’t work out what.
Anyone able to help.
I've worked it out now. It was the format of the connect string for HSQL.
I needed to add :file: in the string like this... jdbc:hsqldb:file:
Also I was using .script at the end of the file name, like this jdbc:hsqldb:.script
This was creating temp files in the format .script.lck .script.log etc.
Dropping the .script at the end of the file name opened up the database and allowed me to see the tables. Now my problem is I can't get any updates to commit. Updates happen with no errors in the console. But when I close the file and check the .script file the data is the same. Permissions I guess.
Only posting this answer to help others that might get stuck at the same point.
Try here:
How can I list all tables in a database with Squirrel SQL?
Where most of us fails is to choose the right schema in the Catalog dropdown. (Just above the Objects tab). But there are other ideas if you follow the related question.

Encrypting Whole Database

I need to encrypt whole databse, not any specific column in the database. This should be done in SQL 2008 or in SQL 2008 Express edition
If any one can, do favour for this
Check this might help you to achive your task :
Understanding Transparent Data Encryption
Using Transparent Data Encryption in SQL Server 2008
Depending on your needs, something like TrueCrypt might do the trick, where you store your data files on an encrypted share. I've never tried it, but I would expect it to work - but some quick Googling shows that people have had problems with it. So if you try this, proceed with caution.