An example:
If I was to have some code such as, SELECT * FROM Table1, and I then saved the script.
I then changed it to:
SELECT * FROM Table2
SELECT * FROM View1
SELECT Column1 FROM Table1
Then is there a way to highlight, within SSMS, the parts of the script that have changed since I last saved?
Nothing to highlight parts of the script itself from what I can tell.
The closest thing that is already in SSMS is:
Tools
Options...
Environment
Font and Colors
Display Items:
Track Changes after save
Track Changes before save
This vertical bar on the left hand side of the script page already exists. I've just changed the colors to make it more visible so I can make better use of it.
Not what I was looking for, but it will suffice.
Related
Let's say I have 20 columns in a table and I run a manual query like:
SELECT *
FROM [TABLE]
WHERE [PRODUCT] LIKE '%KRABBY PADDY%'
After viewing the results, I realize I only need 10 of those columns. Is there a quick way to list out the 10 columns you want, something like right clicking on the wild card and somehow selecting the columns you want?
Right clicking the * and selecting the columns doesn't sound terribly fast either.
You can use SSMS to go to the table, and drag the "Columns":
You'll get every column, and then you can keep the ones you want:
As far as I know you can't do exactly what you are asking for, but in SQL Server Management Studio you can obtain the SELECT statement with all the columns of a table by right-clicking he table on the object explorer an select the options:
script table as --> SELECT to --> Clipboard
Once you have this SELECT is prety easy to eliminate the columns you don't need on the SELECT
Another SSMS solution:
Highlight the query.
Right click it, choose "Design Query In Editor".
The query designer will automatically expand the * to a column list.
As you tick and untick the columns you want in the top panel, the text of the query in the bottom panel will change to match.
Hit "OK" and it'll write the new query over the old text in the editor.
I've not used this much myself (I generally just type) but it seems to work fine for simple queries.
Is there an expression that I can use in MS Access ,to highlight Duplicate entries in Reports?
I tried something like Expression is : Count(*)>1 but it doesn't work.
Br,
I suspect that the original query will need to be bulked up with a sub-query that has an ID column and count of ID. The outermost query will then need to also return the ID count.
Within the report you'd then need add another field that would show the linked ID count if it was > 1.
Access reporting (and forms) allows conditional formatting to be used in a similar way to excel.
See Ribbon: Report Design Tools>Formt>ControlFormatting...
It will let you change the format of a control depending on the value it, or another control, contains.
It's a very nice feature and will also let you add bar charts to you list forms to graphically represent the values sorted in a control.
However, the data set will need to have a column that indicates whether the current row has duplicate records. The snippet from you current query that you provided (that I repeat below) will not do this:
...OR (((Object.Key) In (SELECT [Key] FROM [Object] As Tmp GROUP BY [Key] HAVING Count(*)>1 )));
Without seeing the whole query I can't really help much, but you will need to remove the use of IN and make the SELECT statement a subquery of the main SQL Statement. The main query resultset will need to be LEFT JOINED to the sub query using the Key field. Because of the LEFT JOIN you can use "isnull(Key)" in the SELECT clause and isnull(Key) will be true for non-duplicate rows.
You can then refer to thiscolumn in your conditional formatting
I hope this makes some sense.
You
For a quick and dirty way to highlight duplicate data:
Select the object you want to highlight if it's duplicated, and make
the background white (or whatever the colour of your background is).
Create a copy of the object that you want highlighted if it's
a duplicate.
Format the copy so it has a highlight, and/or add extra text
(eg: DUPLICATE)
Put the copy behind the original (so it can't be seen).
On the original object, select "Hide duplicates" in properties.
Ensure "Hide duplicates" is NOT selected on the copy.
So when the duplicate appears, Access will hide it, but then the object you've created that was originally hidden beneath now becomes visible - effectively highlighting the field.
(Unfortunately it will only highlight the field itself, not the entire section.)
I am using an .rldc file to define the layout of the reports from my program. The problem is, it is to be used for incremental printing. That means the paper will be used over and over as newer rows need to be printed. I'm attempting to approach it this way:
List all corresponding data on the report view.
Make the older rows invisible and only show the latest row.
Print.
That way, the last row is already properly placed. The problem is, I don't know how to implement this. Can anyone help me out?
You could create an IIF(condition,true,false) statement in your report definition on the row visibility variable.
The best way i guess is to define in your data source something of a rank column.
example :
select col1,col2,col3,RANK() OVER (ORDER BY col3 DESC) AS 'rank' from table1
Then in your table or matrix, you click on the row or/and column that you want to make the borders and text white based on a expression.
Go to the properties and dropdown on bordercolor
choose expression and type in (based on my example query)
=IIf(rank.value <> max(rank.value),White,Black)
That will not remove the rows only make the borders white ( unvisible)
The same you can do with Font Color property.
I think this is your best shot at this issue.
Other solution I could think of is to just hide unneccesary rows (which also replaces the visible row)
Then to move the table down by using a expression with a formula like nr of rows hidden before the actual row * height of 1 row, only I m not sure if this is applicable without programming an RDL extension..
Good Luck !
is there a way to clear an entire column in a datasheet in access? i can just right click on it and delete it but that will affect the structure, i just need to clear all the records. how do i do this?
perhaps the question i should be asking is how do i clear the entire contents of a datasheet in access?
Use an update query, e.g.
UPDATE YourTable
SET YourColumn = NULL
There doesn't seem to be a way to do this directly from the UI, which kind of makes sense.
See
Update data by using a query - Microsoft Office Online
UPDATE table_name
SET field_name = NULL;
Much simpler: right click on the column header in access, select copy. Now go to excel and paste into a excel column. Now hit the delete key, then copy that. Go back to access right click column header and paste. Done.
Note: When selecting what to copy in excel may want to exclude column header or may get extra blank record.
Use Replace All function for CURRENT FIELD, FIND WHAT = * and REPLACE WITH = blank. Took 10 seconds to blank out 22600 records. Make sure you LOOK IN = CURRENT FIELD and that field is highlighted.
right click on upper left square of the datasheet, click DELETE RECORD
I am converting reports from version 2 to version 3. When I select the vertical table in the report, the propeties box appears but any changes I make is not reflected in the table. If I change any attributes at the column or cell level however, the changes are taken. The problem is that some attributes like alternate row coloring are not available at the column level.
Are you pressing enter after making the change? It sounds like a silly question, but I know failing to press enter after changing a universe for a query source won't be saved by the editor and it immediately reverts to the original value.