I am learning SQL and I noticed that when you select code that is repeated, it gets highlighted.
My question is if there is any way to change all that repeated code at once, instead of manually changing it.
[example of what I mean]
https://i.stack.imgur.com/LOfCv.png
I bet there is just a keyboard shortcut, but I couldn't find it.
Thank you,
In the query editor, right click the repeated code and select Change all Occurrences or Ctrl+F2:
Related
I have a table which I update using a stored procedure. One column is for the image Url. The code in the stored procedure looks like:
UPDATE Products
SET ImageUrl = 'https://images.XXXXXXX.com/lm/image/s/'+RIGHT(Source,2)+'/'+Source+'_'+Code+'.203'
I need the url to be in a single line in the cell however, it splits the url right before .203 when writing it into the cell. So, in the cell, it is like;
https://images.XXXX.com/lm/image/s/ab/g671235_12312
.203
It normally is no problem for me but I use this data in XML. And Since the Url is not in one line, the remote server I connect does not update the image when I submit the XML. When I manually fix the Url and put it in one line, it just works fine. I googled and searched to find a way to fix this issue, but I could not find a solution. Any help will be appreciated.
Thanks
It sounds like there is a carriage return/newline feed captured within your "Code" column. I have encountered this many times when users manually fiddle with values (they update the value and then hit thinking this will apply the value when this is just inserting the r\n\ values within the column).
To double check if this is the case:
Locate the value that is causing this line break to appear
Copy that cell value (I assume you are using SSMS)
Open Notepad++, Sublime, or similar editor that will display non-printable characters
Set your editor to display non-printable characters (in Notepad++ it is View > Show Symbols > Show All Characters)
This should then display the line break characters that are causing your headaches
Quick solution: Scrub \r\n values - https://stackoverflow.com/a/951705/8026186
More Ideal Solution Prevention of \n\r insertion
If you have access to the data being entered in the database, the best way to avoid this is to prevent the \r\n from making it into the cell in the first place. The quick solution will work in case you don't have the leverage to control initial input. However, from past experience, you will want to avoid non-printable values from appearing in the first place.
Hope this helps!
you most probably going to think "what an idiot" but remember i never done any type of coding before so this is all new to me,
My problem are that i'm working on a HUGE excel sheet with loads of data that is not needed. i need to sort the data into a few columns, i only need column "A,K,AN,AQ" but in column "AS" i only need certain values (yes,no,blank) i only want the yes and blank values. like i said never done any coding before but i know that you can use an macro to do it so please help, how do i go about this?
before trying to get into macros, try to use functions with if else statements. They are quite easy to handle. Like: If (yes) then put it into X. Later, you could select all needed. Also, check the, how the dollar sign is used
use this links to see, if it is something for you.
One quick and dirty way of getting this job done would be to:
Delete the columns you don't need.
Select all cells in the range you're interested in, click the Insert menu, and choose "Table". If your columns have titles, select the box for "My Table has Headers."
-This turns your data into an array so that Excel recognizes that each row is an entry (instead of thinking that the cells are unrelated).
Now you can use the filter icon in the column headers to select and display only the rows containing the values in column X that you're interested in.
Note that there are some limitations to what the table feature is good for, so, as always, whether this is a good solution for you depends on what you want to do with the data.
Google has not found the solution i need so i thought i would try the genius on here to the never ending Excel issue I'm having.
Running a banking reconciliation workbook and slowly adding bits of VBA together to automate some of the tasks, one I'm working on now is finding large quantities of money and renaming their Identifier from a bank statement to same ID in our cashbook to they are found and will balance out.
To do this I'm running a IF(Vlookup()) returning a yes or no on the cash value and then reordering them once they are found so i can line them up and match them correctly.
The main issue I've got here is the vlookup is ignoring some values which i can see and saying no not found and i messed around figuring out why and until i clicked to edit the cell and then pressed enter not changing the amount and all of a sudden found and it only finds it in the vlookup if i click the cell and press enter.
I have tried Formatting, changing calculation to automate and tweaked the vlookup to include a +0 as well as changing the exact match to approximate and it still won't find it, i even tried trimming and checked the Len for whitespace and both equal the same.
Currently trying a for loop to select a cell and change it to itself so it mimics the select and enter but it runs slow and crashes.
Anyone got a decent idea of fixing this miss when searching
This often happens to me when pasting data from somewhere. It may have been pasted as text but then when you edit and press enter it changes to numeric.
The solution is to use =VALUE() to change the numbers to numeric.
Or when you paste the data from another source choose paste special as text.
VLOOKUP works strangely when is asked to do an approximate match with the look-up table unsorted by the look-up column.
If you're sure that an exact match should be enforced in your look-up column, try something along the lines of:
VLOOKUP(<lookup_value>, <table_array>, <col_index_num>, FALSE)
where <lookup_value>, <table_array>, <col_index_num> should be replaced with the values that you use in your look-up.
There are situations where column editing mode works great. One thing I'm finding a bit annoying right now though, is that I don't know how to skip to the left or right without editing while in column mode. Check the attached picture.
So I've got some values in a matrix (copied from a select in DBVisualizer), and I want to add quotes and commas and stuff so it works as an SQL script. Currently my elongated cursor is positioned at the start of the "value2" column, and I want to skip to the end to add a quote there, a comma and another quote and then skip to the end of value3 and so on.
I get that I could do this another way - use regexp or do a better extraction of the text to start with. But now that I am where I am, I think there should be a way to navigate horizontally without losing the vertical selection that I've done. If I press left or right the selection collapses to a single line, same thing if I try ctrl-right (skip word).
Is there a key combo that does what I want in IntelliJ? If not, could I use some other tool (I'm on Ubuntu but if there's something in Windows that could work too)?
IJ doesn't support that at the moment. However, huge multi-line editing improvements are planned for the next version (v.13, ETA is the end of 2013). Feel free to track IDEA-80056 progress.
I hope you can help me with this little problem. I am not quite sure of how to explain the situation to you, so I will just give it a try.
What I am trying to do is the following:
I want to insert some specific values and parameters (which I type in myself) into the table RFC_Risks, so basically every time I find a specific reason inside the table RCF_Risks, I want to write a new row that updates the priority of the RfC, every time that happens, the position shall be increased by 1.
My problem is now, that when I run this statement, I just get the SELECT part :-), not inserting is done, neither do I get a SQL statement error or anything like that. I just type in the parameters and then I get a SELECT Table thats all.
I'm using MS Access 2010 and I hope you can help me out with my "little" problem.
INSERT INTO RFC_Risks (RFC_No, RiskPos, Datum, Comments, RiskPrio, Reason)
SELECT RFC_Risks.RFC_No, (RFC_Risks.RiskPos +1) AS RiskPos, [Aktuelles Datum] AS Datum, [Kommentartext] AS Comments, [Neue Prio] AS RiskPrio, RFC_Risks.Reason
FROM RFC_Risks INNER JOIN Risk_Reasons ON RFC_Risks.Reason = Risk_Reasons.Reasontext
WHERE RFC_Risks.Reason = Risk_Reasons.Reasontext;
I can't spot anything about your SQL statement which would prevent it from executing and/or throw an error. (I think your WHERE clause is redundant, but that should not cause the db engine to reject it.) What method are you using to "run" it?
If you're using the Access query designer, and switch from Design View to Datasheet View, your query isn't actually executed ... Datasheet View will show you the rows which would be affected if the query were executed.
The situation is the same as if you were building a delete query in the query designer ... Datasheet View would show you which rows would be deleted if the query were executed, but switching to Datasheet View does not delete those rows.
To execute the query, click the icon which has a red exclamation point.
Try enclosing the subselect in parentheses.
You need to execute your query. If you only display it in Datasheet View, the SELECT Statement is executed and displayed to you as a kind of preview.
To really execute the query, when you are in design mode, you can click on the "Run" button (a red exclamation mark) in the toolbar. You can also double-click on the query in the database window.