Showing posts with label pretty. Show all posts
Showing posts with label pretty. Show all posts

Tuesday, March 27, 2012

Convert a Date to a Day of the Week.

Hey, Im pretty sure this is possible, but let me know if it isnt.

I have a table of dates in the format "DD/MM/YYYY", is there a way of converting it to output the day of the week? for example 16/11/2007 would display Friday insted.

Thanks in advance John

selectdatepart(dw,GETDATE())

selectdatename(dw,GETDATE())

|||

Hi u can check out this

select datepart(dw,date_created) from users

select datename(dw,date_created) from users

Thank u

Baba

Please remember to click "Mark as Answer" on this post if it helped you.

|||

Thanks to the both of you, both methods worked amazingly faultlessly. Thanks John

Tuesday, March 20, 2012

conversion

Hi All,
I am pretty new to sql server. I have a column with data in the format
of #ddd,dddd
where d is a number between 0 and 9.
e.g. one entry of column #34,56
What is the easiest way to convert it to integer? #56,5-->565
Thanks a lot
Thanks.So the comma is not significant? If so, try:
select
cast (replace (replace (MyCol, '#', ''), ',', '') as int)
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
<jack.smith.sam@.gmail.com> wrote in message
news:1162070389.388509.50190@.m7g2000cwm.googlegroups.com...
Hi All,
I am pretty new to sql server. I have a column with data in the format
of #ddd,dddd
where d is a number between 0 and 9.
e.g. one entry of column #34,56
What is the easiest way to convert it to integer? #56,5-->565
Thanks a lot
Thanks.|||If you want to permanently convert the column datatype to integer, use
Tom's suggestion to clear the non-numeric characters out of the current
column, and then use
ALTER TABLE MyTable
ALTER COLUMN Mycolumn int
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
You can't help someone get up a hill without getting a little closer to the
top yourself.
- H. Norman Schwarzkopf
<jack.smith.sam@.gmail.com> wrote in message
news:1162070389.388509.50190@.m7g2000cwm.googlegroups.com...
> Hi All,
> I am pretty new to sql server. I have a column with data in the format
> of #ddd,dddd
> where d is a number between 0 and 9.
> e.g. one entry of column #34,56
> What is the easiest way to convert it to integer? #56,5-->565
> Thanks a lot
> Thanks.
>sqlsql

conversion

Hi All,
I am pretty new to sql server. I have a column with data in the format
of #ddd,dddd
where d is a number between 0 and 9.
e.g. one entry of column #34,56
What is the easiest way to convert it to integer? #56,5-->565
Thanks a lot
Thanks.So the comma is not significant? If so, try:
select
cast (replace (replace (MyCol, '#', ''), ',', '') as int)
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
<jack.smith.sam@.gmail.com> wrote in message
news:1162070389.388509.50190@.m7g2000cwm.googlegroups.com...
Hi All,
I am pretty new to sql server. I have a column with data in the format
of #ddd,dddd
where d is a number between 0 and 9.
e.g. one entry of column #34,56
What is the easiest way to convert it to integer? #56,5-->565
Thanks a lot
Thanks.|||If you want to permanently convert the column datatype to integer, use
Tom's suggestion to clear the non-numeric characters out of the current
column, and then use
ALTER TABLE MyTable
ALTER COLUMN Mycolumn int
--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
You can't help someone get up a hill without getting a little closer to the
top yourself.
- H. Norman Schwarzkopf
<jack.smith.sam@.gmail.com> wrote in message
news:1162070389.388509.50190@.m7g2000cwm.googlegroups.com...
> Hi All,
> I am pretty new to sql server. I have a column with data in the format
> of #ddd,dddd
> where d is a number between 0 and 9.
> e.g. one entry of column #34,56
> What is the easiest way to convert it to integer? #56,5-->565
> Thanks a lot
> Thanks.
>

Monday, March 19, 2012

Controls pushed off to the right

This is pretty weird... any controls past the halfway horizontal point of the report get pushed into page 2. The leftmost control is not affected just those to the right of it. It's like there is an invisible tab after the leftmost control. Smaller (not leftmost controls) (not past the middle of the page) are also pushed way to the right (just not into a new page)

Is there some property (that I'm not aware of) that does this? It doesn't matter if I use textboxes or lines. I have not changed any of the default control properties. flow layout is still LTR.
In my current report I have questions and answers on separate lines...I can't place them next to each other or it screws up the pagination.

I start with a new report and it does not do this but as soon as I add 2-3 vertical pages (over 11' x 2) This starts happening.

Has anyone experienced this?

I have experienced this in trying to lay out textboxes next to each other. The one to the right ends up getting pushed much further to the right then I want it to. The I've found to stop this from happening is to put both of my text boxes in a rectangle and then size the rectangle to match the width of the page. Then I can place my text boxes where I want within the rectangle and they'll stay put, for the most part.

Controls pushed off to the right

This is pretty weird... any controls past the halfway horizontal point
of the report get pushed into page 2. The leftmost control is not
affected just those to the right of it. It's like there is an
invisible tab after the leftmost control. Smaller (not leftmost
controls) (not past the middle of the page) are also pushed way to the
right (just not into a new page)
Is there some property (that I'm not aware of) that does this? It
doesn't matter if I use textboxes or lines. I have not changed any of
the default control properties. flow layout is still LTR.
In my current report I have questions and answers on separate
lines...I can't place them next to each other or it screws up the
pagination.
I start with a new report and it does not do this but as soon as I add
2-3 vertical pages (over 11' x 2) This starts happening.
Has anyone experienced this?Select from the menu format->align and left/center/right. I think it should
be with alignment. because you said all the controls comes to left side of
the page.
Amarnath
"tom booster" wrote:
> This is pretty weird... any controls past the halfway horizontal point
> of the report get pushed into page 2. The leftmost control is not
> affected just those to the right of it. It's like there is an
> invisible tab after the leftmost control. Smaller (not leftmost
> controls) (not past the middle of the page) are also pushed way to the
> right (just not into a new page)
> Is there some property (that I'm not aware of) that does this? It
> doesn't matter if I use textboxes or lines. I have not changed any of
> the default control properties. flow layout is still LTR.
> In my current report I have questions and answers on separate
> lines...I can't place them next to each other or it screws up the
> pagination.
> I start with a new report and it does not do this but as soon as I add
> 2-3 vertical pages (over 11' x 2) This starts happening.
> Has anyone experienced this?
>

Tuesday, February 14, 2012

Constructing a Query

Hello all,

I am fairly new to using SQL in a production environment. I've gotten the management studio pretty much figured out and now I am finding the need for some more advanced knowledge. I would like to adjust the database autogrowth settings for each of my databases; however I have no prior statistics to examine to tell me how much the past years worth of being in production has caused the databases to grow.

I have found that I can look at each database in turn and select a basic report of disk usage that happens to include records of the last few autogrowth periods and particulars about each growth. What I would like to do is create a report (The same disk usage report) that includes all of my databases (I have about 30 active databases for MS Dynamics Great Plains.) I figured that I can create a maintenance plan consisting of a transact-SQL function that will run the same query, or a similar query that will report to me: Autogrowth statistics for each database in turn since it's inception (less than a year ago).

Perhaps there is an easier way to achieve the same results. If there is a way to create / run the same disk usage report for multiple databases, and have the results returned in a consolidated form, I have not yet figured out how.

I hope that someone out there has a solution for this; what i'm sure is not a new issue but mearly a newbie issue.

Thank you all in advance for any advice you may have.

Normally, you don't want to use 'Autogrow' on production servers. Autogrow causes excessive file fragmentation, and often occurs at the most inopportune moments (Autogrow is a performance hit.)

You would be best served to determine how much new space will be required over a period of time (week, month, year, etc.) by examining the historic records you have. Then exand the database files sufficiently to allow for all activity for the next period of time.

|||Ok, I can accept that. I've got a maximum of about 8 users working on a very beefy sql box. I have no concern about overall preformance just yet. However I WILL take your advice and remove the autogrowth. I still, however need to collect some pervious growth statistics. My question still remains, is there a way to script a report that will just pull the autogrowth statistics for all of my databases from the time of their creation?|||No, as far as I am aware, that historical information is not available.|||

Ok, Then lets take one step further back.

Since there is already a builtin 'disk usage' report that can be run on a database. Can I use a Transact Sql query to pull that same report (which will contain autogrowth history) for all (or a select number) of databases and filter through it at my leasure?

If so, I'll probably need some help with scripting of said query.

Thank you for your time and advice,