Can you arrange column display order using Diagram view? - sql-server

I'm creating tables in SQL Server > Diagram view, i just find it easier sometimes to do all the relationships, etc. Anyways, I was having trouble re-arranging the order of the columns while i'm in Diagram view, It thinks i want to make it a relationship/key instead of dragging the column before/after another one. It works fine when in the standard table creation screen (the re-arranging part) but not when i'm in Diagram view, why is that? Is there a way around it?

Not possible, can only Cut the row then insert the row and paste it.

I don't believe it is possible to do what you would like here. In theory, if it were to allow you to change the order of the columns it would be changing the underlying table which is not possible without dropping the table first.

Related

Group chunks of data of antd table

I tried to find a solution for this particular problem, but so far I've come up empty. I want to be able to group the data in my table by a specific field in my data, but I want to be able to do it as shown in the image below.
As far as I have researched, antd table doesn't offer this specific functionality or anywhere close to help me getting the below format. I've also considered creating a dataless table for the header and several tables for each data group, but then I don't know if I would be able to sync each column width other than assigning fixed values to them in addition to being able to style each header accordingly, which I would rather avoid. Grouping table head doesn't seem to be a solution here either.
Basically, is there any way I can insert a custom row in my antd table that I can design as I want?
In the end, I settled with splitting the data into chunks and creating a table for each chunk. The only downside of this is not having only one header for all the tables as above, but showHeader={false} can be passed to the antd tables for a cleaner look.

Most efficient way to view data in table in SQL Server?

Basically if I want to see what the data in a table/view looks like I use
select top 1000 * from ...
But this isn't too efficient for complex views or badly indexed tables.
I really just want to see what the data in a table looks like, e.g. the format etc.
Is there a better way to do this?
I'm using SSMS 2017
*Edit for clarification:
Badly written views are endemic throughout our databases so whilst fixing these is the obvious answer it's not really a realistic one.
I suppose i was hoping for a trick i wasn't aware of, because i understand using TOP puts some sort of order into it
If you highlight a table/view object in code and then press ALT + F1 in SSMS IDE it will execute the equivalent command of sp_help ‘object_name’ where object_name is the name of the highlighted object. Maybe this can give some quick information about the object you are interested in.

Access Database - Display different data

Good morning everybody, this is the first time I write in this forum so, i'm sorry if I do some error!!!
I'm working on a project in Visual Studio where I'm connecting to an Access Database. The most important thing is that this Database is not mine and I can't modify it because it is updated daily by another automatic software.
I have to think that this database is "Read Only".
This database only has tables with primary key but there are no relation between tables.....it really looks like different Excel sheets!!!
I don't have problem to import the tables in a DatagridView of my Visual Studio project but in these tables the data are not easy to be understood for example:
there is a column named "Color" where the color are filled like number but there is not another Table who contain the color code. I know in my mind that color 1=Red, 2=Orange, 3=Brown etc.....
What I want to do?
I want that in my DataGridView won't be show the numbers but the color name so I need to modify my DataGrid source before display data.
How is did my project?
I have my DatagridView whose data source is a BindingSource that has a Dataset as DataSource. On my Load event I use the "Fill" method of my TableAdapter to display my tables data
Could someone suggest me how modify data before display them?
Thanks a lot
Giacomo
If all you are dealing with is a limited number of values in one or two fields, you could select the records using a query and obtain the color as follows:
SELECT Table1.ID, Table1.FldA, Table1.ClrFlag, IIf([clrflag]=1,"RED",IIf([clrflag]=2,"Orange",IIf([clrflag]=3,"Brown","Unknown")))
AS MyClr
FROM Table1
If there are many lookup's to do, I would create my own database with tables of code translations and join the two databases to produce my result. The following is an example of SQL pulling from two databases:
https://support.microsoft.com/en-us/help/113701/how-to-access-multiple-databases-in-an-sql-query-in-vb-3-0

BIRT Dynamic Columns

What I am currently looking to do is use our existing UI to select a number of columns from various tables (yes, multiple tables) and pass them into a BIRT report as parameters. From there, I am planning on building a query that will dynamically replace the columns into the query and pull the results automatically. I'll have to hide columns with no value passed to them as well. I also expect I'll have to setup the query to be a little heavy handed and already know all of the logical connections in the database (e.g. connect the proper tables, etc).
My question is this the best way to manage a dynamic column/table in a dataset? or is there a better way to manage this method? I'v seen some online information about the "ad-hoc" BIRT report designer that lets non-programmers create reports, but I am not looking for other people to actually build the report, just generate one using an existing template with interchangeable columns.
I think the easiest way is to firstly build a report with all columns that you need.
Then apply some logic on the visibility of the column. You can use the parameters there as well.
Select your table, select a column, open the properties window and take a look at the visibility tab there. Just add some logic that results in a true or false.
If you are using a crosstab to display the information, you could use the filter options to include or exclude columns.
Yes, this will load data that is not used, but you need to build realy big reports for performance becomming a real issue.
If you try to add this logic in the actual dataset, you have to make the query and fetch script dynamic and then you still have the problem with the visualisation of the columns. I think you'll end up using the visibility script anyway (to show/hide the colums on the report), so might just start from there and have a working report fast.

Adding a new dimension based on a key in fact table linked to one of the dimension tables

I have a fact table that holds all date & time attributes as keys which links to actual DATE & TIME dimension.
When I create a cube on top of it using SSAS 2005, these datetime attributes are split into individual dimensions for the CUBE, which is OK.
Problem is when I add a new datetime attribute to the fact table, my cube doesn't accept that and would not create a new datetime dimension just like the other ones, unless I recreate the cube from scratch.
Can anyone please suggest, how can I add this new attribute separately as a dimension, without having to recreate the cube?
I'm struggling to understand your issue.
It sounds as if you are trying to add a new datetime column(fact) (referenced to your apporpriate Dimension/s attribute) to the Fact table. If so, this changes the structure of the cube and so requires that the cube be re-processed.
To qualify correct use of terminology, a Dimension contains Attributes. A Fact table contains Facts not attributes.
The following reference may be of use.
http://msdn.microsoft.com/en-us/library/aa905984(SQL.80).aspx
Re: Comments
Any structural changes need to be applied/registered within the Data Source View (DSV) in the Business Intelligence Development Studio (BIDS), prior to processing the cube. Clicking the refresh button on the DSV, should prompt you with an option to apply any discovered changes to your tables. Also, should any of your additions/modifications be to the underlying tables of Dimensions, then you may also need to add the attributes in question to the appoprirate Dimension .dim file, prior to re-processing the cube.
Hope this makes sense.
The problem usually comes because of Unknown Member and Null Processing options setup along with the snowflake schema if you have it in your cube. I figured out what the problem actually was.
If you have a case as one mentioned, then SSAS doesn't bring up the structural changes by itself when you refresh the Data source view. In my case, since it was date & time dimensions, I had to add new dimensions manually (Cube dimensions) and setting their NULL Processing options correctly (in my case UnknownMember and not Automatic).
Since it can be tad difficult to do these changes for all such new columns added to underlying fact table, you can try updating the XMLA script using Find & Replace method, carefully crafted.

Resources