remove text quotations using sql - sql

I am getting data from odbc connection using SQL , the problem I have is that all the text format data still have " " , is there anything in SQL I can add to remove these please. example "John" would like it to be just John

Related

SQL Server select query output shows as "???????"

I got an email from my senior, to update a table column in SQL server.
In the mail they mentioned the data to update.
But when I copied the below mentioned content and used select query in SQL Server it results in "??????" characters.
Landmark : 𝚗𝚎𝚊𝚛 𝚔𝚘𝚙𝚊𝚕 𝚔𝚒𝚍𝚜 𝚌𝚘𝚕𝚕𝚊𝚐𝚎,𝚋𝚑𝚊𝚠𝚛𝚊𝚜𝚕𝚊
select 'Landmark : 𝚗𝚎𝚊𝚛 𝚔𝚘𝚙𝚊𝚕 𝚔𝚒𝚍𝚜 𝚌𝚘𝚕𝚕𝚊𝚐𝚎,𝚋𝚑𝚊𝚠𝚛𝚊𝚜𝚕𝚊'
I tried varbinary, ASCII conversion in SQL server and tried to format the data using word and excel but nothing works for me.
To my knowledge I think the data is in image format.
Please help me with this issue.
Note: I can simply type the content and update, but for my curiosity I want to know how to fix this issue.

Populating SQL String Using VBA in a MS Access Application

I have quite a complex requirement where I need to populate a SELECT query with parameters coming from a list box in Access. All seems to be working fine except for the SELECT part of the query, In short, I need the VBA code to populate the following in my Access query:
SELECT TRIM(ACCOUNT_NO)&","&UNITS FROM GRV_OFFICE
I have the following in my VBA code:
strSQL = "SELECT TRIM(ACCOUNT_NO)" & "," & "UNITS FROM GRV_OFFICE"
But for some reason it keeps populating it as follows in Access:
SELECT Trim(ACCOUNT_NO) AS Expr1, GRV_OFFICE.UNITS
The reason I am using trim is because this is eventually exported from the database to populate an import into another application. Without the trim there are unnecessary spaces which are messing with the subsequent import process.
So the ultimate result of this query should be the ACCOUNT_NO with a comma and then the number of units in one field.
I find this really frustrating as this should be the easy part of the project.
Any assistance will be appreciated.
You need to use concatenation to get two column fields together.
Below code may work:
strSQL = "SELECT TRIM(ACCOUNT_NO) + ' ' + UNITS as newColumn FROM [GRV_OFFICE];"
Reference : https://www.mssqltips.com/sqlservertip/2985/concatenate-sql-server-columns-into-a-string-with-concat/

Select query on DB2-SQL failing

I am very familiar with MYSQL. Right now, trying a query on IBM SQL DB(DB2) :
"select displayname from HOMEBASEDAPP.LOGINDB where username = '" + username +"' and password = '" + password +"';"
This is the error I get when I run the query.
error occurred [IBM][CLI Driver][DB2/LINUXX8664] SQL0206N "USERNAME" is not valid in the context where it is used. SQLSTATE=42703
I have attached a screenshot of how my table looks :
Your query is failing because DB2 expects all database objects to be uppercase by default. So much so, that it automatically translates your lower-case column names in your query to uppercase before execution.
Since your column names are lowercase, this query fails.
My recommendation is to convert your column names to uppercase, as this will save you much pain in the long run.
However, simply wrap the column names within your query in double-quotes and DB2 will preserve the correct case, and the query should work.
I believe this will work:
SELECT "displayname" FROM HOMEBASEDAPP.LOGINDB WHERE \"username\" = '" + username +"' AND \"password\" = '" + password +"';"
Note: your query here is extremely insecure and is open to SQL injection attacks among other things. Hopefully you plan to use a driver within your app that will allow you to 'prepare' your query and provide means to simply pass in values as parameters.
you need to modify your sql script ,otherwise on finding the first occurrence of double quote,db2 will treat it as terminating character,I mean to say query will be executed till below,so that you will get error:
db2 "select displayname from HOMEBASEDAPP.LOGINDB where username = '"
You need to take care of double quotes for parsing of full sql query, for detail below is a sample reference link:
http://www.justskins.com/forums/insert-with-double-quote-148522.html

SQL query syntax error using INSERT INTO

So, I know my code for the database connection and reader is functional, because it has worked for me many times before, however, something about this SQL query:
gives this error message:
when this data is inputted:
This is the database table that I am trying to add the data to:
The issue is that you are using "password" as a column name and that's a reserved word in Jet SQL. Either change the name or escape it in SQL code. You do the latter by wrapping it in square brackets [].

SQL/ASP - Invalid column name 'Email'

i am having trouble adding stuff into the Email column. I can add stuff into the Username column but for some reason i get the following error:
Microsoft OLE DB Provider for SQL Server error '80040e14'
Invalid column name 'Email'.
When I use this code:
Set rstSimple = cnnSimple.Execute("insert into SALT (Email, Username, FirstName, LastName, ActivationCode, TransactionID, ClientID) VALUES ('" & Request.QueryString("payer_email") & "','" & Request.QueryString("payer_email") & "','" & Request.QueryString("first_name") & "','" & Request.QueryString("last_name") & "','" & Request.QueryString("hash") & "','" & Request.QueryString("txn_id") & "','" & Request.QueryString("client_id") & "')")
Can somebody please help me?
Thank you
If the error states "Invalid column name 'Email' I would check:
Does the column 'Email' exist in the database and in that format?
What value are you inserting into the column? If Username works and Email doesn't, are they different types? Maybe Email doesn't except NULL values and Username does? If you are then trying to put a null e-mail address into Email then it won't work.
Other that looking at your database schema, there isn't much more I can guess from this.
Paul
I just encountered a similar problem today... reading values off the MSSQL database, the "Email" column is coming up blank/null in my ASP program.
But checking the table using SQL Enterprise Manager shows there is data in the "Email" column.
I couldn't find anything wrong with my code and I'm running out of ideas. Just for the heck of it, I tried to rename the field "Email" to something else, like "UserEmail". And voila!!!! My code is working again.
So try renaming your column "Email" to something else. I did some search and couldn't find anything that says "Email" is a reserved word in MSSQL and that you can't use "Email" for column names.
I do not know if it has an email
column in it because none of the damn
programs let me connect to the
database
Try downloading and connecting SqlDbx to your database using the same ODBC connection. It will allow you to view the schema of your database easily and to edit and execute queries.
http://www.sqldbx.com/ (free for personal use)
Microsoft also has a SQL Server management express tool that is also free