Showing posts with label order. Show all posts
Showing posts with label order. Show all posts

Wednesday, March 28, 2012

How to change sort order of the server?

Hi i need to change teh sort order from :
Collation=Latin1_General_BIN, SQLSortOrder=0 to
Collation=SQL_Latin1_General_CP1_CI_AS, SQLSortOrder=52
Can you please tell me what is the best way
"RS" <RS@.discussions.microsoft.com> wrote in message
news:C1A33FAA-0BAC-4A86-9438-ACA90AD00DF7@.microsoft.com...
> Hi i need to change teh sort order from :
> Collation=Latin1_General_BIN, SQLSortOrder=0 to
> Collation=SQL_Latin1_General_CP1_CI_AS, SQLSortOrder=52
> Can you please tell me what is the best way
Backup all of your user databases, or use sp_detach_db.
Run the rebuildm procedure to rebuild your master database. Choose a
different sort order.
Reattach your databases.
Rick Sawtell
MCT, MCSD, MCDBA
|||HI i have the master DB with this Collation=SQL_Latin1_General_CP1_CI_AS,
SQLSortOrder=52 and i have deattache the DB that has the Latin1_General_BIN,
SQLSortOrder=0 and reattach again and nothing happen
do u have any other plans?
"Rick Sawtell" wrote:

> "RS" <RS@.discussions.microsoft.com> wrote in message
> news:C1A33FAA-0BAC-4A86-9438-ACA90AD00DF7@.microsoft.com...
> Backup all of your user databases, or use sp_detach_db.
> Run the rebuildm procedure to rebuild your master database. Choose a
> different sort order.
> Reattach your databases.
> Rick Sawtell
> MCT, MCSD, MCDBA
>
>
|||Hi
Use ALTER DATABASE command and ALTER TABLE ALTER COLUMN command for each
tables and columns.
Andras Jakus MCDBA
"RS" wrote:
[vbcol=seagreen]
> HI i have the master DB with this Collation=SQL_Latin1_General_CP1_CI_AS,
> SQLSortOrder=52 and i have deattache the DB that has the Latin1_General_BIN,
> SQLSortOrder=0 and reattach again and nothing happen
> do u have any other plans?
> "Rick Sawtell" wrote:

How to change sort order of the server?

Hi i need to change teh sort order from :
Collation=Latin1_General_BIN, SQLSortOrder=0 to
Collation=SQL_Latin1_General_CP1_CI_AS, SQLSortOrder=52
Can you please tell me what is the best way"RS" <RS@.discussions.microsoft.com> wrote in message
news:C1A33FAA-0BAC-4A86-9438-ACA90AD00DF7@.microsoft.com...
> Hi i need to change teh sort order from :
> Collation=Latin1_General_BIN, SQLSortOrder=0 to
> Collation=SQL_Latin1_General_CP1_CI_AS, SQLSortOrder=52
> Can you please tell me what is the best way
Backup all of your user databases, or use sp_detach_db.
Run the rebuildm procedure to rebuild your master database. Choose a
different sort order.
Reattach your databases.
Rick Sawtell
MCT, MCSD, MCDBA|||HI i have the master DB with this Collation=SQL_Latin1_General_CP1_CI_AS,
SQLSortOrder=52 and i have deattache the DB that has the Latin1_General_BIN,
SQLSortOrder=0 and reattach again and nothing happen
do u have any other plans?
"Rick Sawtell" wrote:

> "RS" <RS@.discussions.microsoft.com> wrote in message
> news:C1A33FAA-0BAC-4A86-9438-ACA90AD00DF7@.microsoft.com...
> Backup all of your user databases, or use sp_detach_db.
> Run the rebuildm procedure to rebuild your master database. Choose a
> different sort order.
> Reattach your databases.
> Rick Sawtell
> MCT, MCSD, MCDBA
>
>|||Hi
Use ALTER DATABASE command and ALTER TABLE ALTER COLUMN command for each
tables and columns.
Andras Jakus MCDBA
"RS" wrote:
[vbcol=seagreen]
> HI i have the master DB with this Collation=SQL_Latin1_General_CP1_CI_AS,
> SQLSortOrder=52 and i have deattache the DB that has the Latin1_General_BI
N,
> SQLSortOrder=0 and reattach again and nothing happen
> do u have any other plans?
> "Rick Sawtell" wrote:
>

Friday, March 23, 2012

How To Change Just Year from a column(DueDate)

Hi
I am getting problem in changing just year from a column name duedate
in order to do m getting all months and day are also changing
help me out

Quote:

Originally Posted by lokaish

Hi
I am getting problem in changing just year from a column name duedate
in order to do m getting all months and day are also changing
help me out


Hey try this...

update tablename set duedate=dateadd(year,2,getdate())

Wednesday, March 21, 2012

How to change column order of a table

Hi,
I need to modify column order of some of my sql server 2k tables
because i want to keep related columns together. How can i do this?
Thanks
Nikhilcreate a view with the columns in the order you want

rudy|||Why?

If you really need to do it.

create an new table as you want the columns to be.

Copy the data into it.

rename the old table to a different name.

rename the new table to the old name.

Fix all the Foreign keys to point to the correct table.

and pray it works!!!

I would suggest getting an book on SQL design because there is normaly no good reason to change the column order of the table.

Tim S|||It's very simple use Enterprise Manager -> Tables _> Design Table -> and use drag and drop to move one column in the position you want (it' necessary to select the row of the column in order for drag and drop to function)

Beware, this only can be done in SQL Server 2k not in any previous versions of SQL Server.

Anyway to move a column has a meaning only for a better visualisation of the table design, because the order of columns, or the phisical order of rows in the table has no importance (it's a base rule of relational database).
But, if you decide to move one column before another, you can do it nothing is going to change within your application.

In fact, there is one problem in SQL 2k. If you are changing the position of a column and for that table you have a trriger that use the function COLUMNS_UPDATED(n) (where n is the no of a row in the table) and after your switching positions of columns the positin of the column implied in COLUMN_UPDATED function changes you should modify your trriger in order to work corectly.

IONUT

Wednesday, March 7, 2012

How to calculate the percentage?

In my cube, I've a date dimension and a time dimension. I would like to know how can I calculate the percentage of order count for a specific time?

I can get this.

Hour11/6/0611/7/069am601010am801011am6020

But how can I get this.

Hour11/6/0611/7/06

9am30%25%

10am40%25%

11am30%50%

I would like to use the calculation feature in available in the cube. How can I do this? Thanks!

Depends on whether the percentage is always based on the time hierarchy, regardless of which query axis it lies on, or is based on whichever hierarchy is on rows - Axis(1). In the former case, something like:

Member [Measures].[OrderFractionByTime] as

'[Measures].[Order Count]/

([Measures].[Order Count], [TimeOfDay].Parent)',

FORMAT_STRING = "Percent"

|||Hi Deepak,

Thanks for your reply but there are something that I don't understand. In your code, you use [TimeOfDay].Parent in the member calculation. However, in my own cube, the date dimension and time dimension are 2 separate dimensions. So, I don't expect my TimeOfDay.Parent will get the expected set.

The following is my Date and Time dimensions structure.
DimDate - The Date dimension is populated by extracting data from my OLTP.
Year
Month
DayOfMonth
Date
DayNameOfWeek

DimTime - The Time dimension is generated by cross join all the available hour, minute and second. (No. of records: 24 x 60 x 60)
Hour
Minute
Second

P.S. I'm quite new to BI and datawarehouse. If my Time hierarchy is not correct or using best practice, please let me know so that I can improve it.

Regards,
Alex|||

Hi Alex,

Are you using AS 2000 or AS 2005 - if it's AS 2000, then something like:

Member [Measures].[OrderFractionByTime] as

'[Measures].[Order Count]/

([Measures].[Order Count], [DimTime].Parent)',

FORMAT_STRING = "Percent"

|||Hi Deepak,

I'm using AS 2005. The problem that I don't understand what [DimTime].Parent is pointing to. The Time dimension and Date dimension doesn't have any direct relationship in my cube. Is there any design fault?

Regards,
Alex|||

Alex,

With AS 2005, the hierarchy should also be specified with [DimTime], so [DimTime].[TimeHierarchy].Parent points to the parent of the current [DimTime] member. For example, the parent of the hour "01" will be [DimTime].[TimeHierarchy].[All].

http://msdn2.microsoft.com/en-us/library/ms145513.aspx

>>

SQL Server 2005 Books Online

Parent (MDX)

Updated: 17 July 2006

Returns the parent of a member.

...

>>

How to calculate the percentage?

In my cube, I've a date dimension and a time dimension. I would like to know how can I calculate the percentage of order count for a specific time?

I can get this.

Hour11/6/0611/7/069am601010am801011am6020

But how can I get this.

Hour11/6/0611/7/06

9am30%25%

10am40%25%

11am30%50%

I would like to use the calculation feature in available in the cube. How can I do this? Thanks!

Depends on whether the percentage is always based on the time hierarchy, regardless of which query axis it lies on, or is based on whichever hierarchy is on rows - Axis(1). In the former case, something like:

Member [Measures].[OrderFractionByTime] as

'[Measures].[Order Count]/

([Measures].[Order Count], [TimeOfDay].Parent)',

FORMAT_STRING = "Percent"

|||Hi Deepak,

Thanks for your reply but there are something that I don't understand. In your code, you use [TimeOfDay].Parent in the member calculation. However, in my own cube, the date dimension and time dimension are 2 separate dimensions. So, I don't expect my TimeOfDay.Parent will get the expected set.

The following is my Date and Time dimensions structure.
DimDate - The Date dimension is populated by extracting data from my OLTP.
Year
Month
DayOfMonth
Date
DayNameOfWeek

DimTime - The Time dimension is generated by cross join all the available hour, minute and second. (No. of records: 24 x 60 x 60)
Hour
Minute
Second

P.S. I'm quite new to BI and datawarehouse. If my Time hierarchy is not correct or using best practice, please let me know so that I can improve it.

Regards,
Alex|||

Hi Alex,

Are you using AS 2000 or AS 2005 - if it's AS 2000, then something like:

Member [Measures].[OrderFractionByTime] as

'[Measures].[Order Count]/

([Measures].[Order Count], [DimTime].Parent)',

FORMAT_STRING = "Percent"

|||Hi Deepak,

I'm using AS 2005. The problem that I don't understand what [DimTime].Parent is pointing to. The Time dimension and Date dimension doesn't have any direct relationship in my cube. Is there any design fault?

Regards,
Alex|||

Alex,

With AS 2005, the hierarchy should also be specified with [DimTime], so [DimTime].[TimeHierarchy].Parent points to the parent of the current [DimTime] member. For example, the parent of the hour "01" will be [DimTime].[TimeHierarchy].[All].

http://msdn2.microsoft.com/en-us/library/ms145513.aspx

>>

SQL Server 2005 Books Online

Parent (MDX)

Updated: 17 July 2006

Returns the parent of a member.

...

>>