Monday, March 26, 2012
Minutes since midnight
system date. Is that possible?
-JohnYes, Dates are stored internally as decimal numbers where the fractional
part is just that, the time since midnight, so cast the datetime value to a
float, and extract the fractional portion , and multiply that times the
number of minutes in a day...
Select (Cast (getdate() as float) - Cast(getdate() as Int)) * 24 * 60
"John Baima" wrote:
> I would like to know the number of minutes past midnight for the
> system date. Is that possible?
> -John
>|||Thanks, that's interesting. How about
Select (Cast (getdate() as float) - round(Cast(getdate() as float), 0,
1)) * 24 * 60
instead? Yours is giving me a negative number.
-John
"CBretana" <cbretana@.areteIndNOSPAM.com> wrote:
>Yes, Dates are stored internally as decimal numbers where the fractional
>part is just that, the time since midnight, so cast the datetime value to
a
>float, and extract the fractional portion , and multiply that times the
>number of minutes in a day...
>Select (Cast (getdate() as float) - Cast(getdate() as Int)) * 24 * 60
>"John Baima" wrote:
>|||Round will round "UP" if it's after noon...
"John Baima" wrote:
> Thanks, that's interesting. How about
> Select (Cast (getdate() as float) - round(Cast(getdate() as float), 0,
> 1)) * 24 * 60
> instead? Yours is giving me a negative number.
> -John
>
> "CBretana" <cbretana@.areteIndNOSPAM.com> wrote:
>
>|||try this:
select datediff(mi,convert(varchar(8),getdate()
,112),getdate())
dean
"John Baima" <john@.nospam.com> wrote in message
news:tsg5511f573eo7rbm31mavp76h78l7li95@.
4ax.com...
>I would like to know the number of minutes past midnight for the
> system date. Is that possible?
> -John|||Try,
select datediff(minute, convert(char(8), getdate(), 112), getdate())
go
AMB
"John Baima" wrote:
> I would like to know the number of minutes past midnight for the
> system date. Is that possible?
> -John
>|||I guess the Cast(Dattime as Int) is also rounding UP... The floor function
always gets the next lowest Integer...
Select (Cast (getDate() as float) - Floor(Cast(getdate() as float))) * 24 *
60
It's only 10:30 out here on the left coast...
"John Baima" wrote:
> Thanks, that's interesting. How about
> Select (Cast (getdate() as float) - round(Cast(getdate() as float), 0,
> 1)) * 24 * 60
> instead? Yours is giving me a negative number.
> -John
>
> "CBretana" <cbretana@.areteIndNOSPAM.com> wrote:
>
>sql
Friday, March 23, 2012
Mining Content Viewer for Linear Regression: Node Distribution output
With the number of threads it is difficult to know if this has been posted. If I use the Mining Content Viewer for Linear Regression, under Node Distribution, there are values given for Attribute Name, Attribute Value, Support, Probability, Variance, and Value Type. The output is similar to what Joris supplied in his thread about Predict Probability in Decision Trees. My questions:
1. How should these fields be interpreted?
2. With Linear Regression, is it possible to get the coefficient values and tests of significance (t-tests?), if they are not part of the output I have pointed to?
Thanks for your help with this?
Sam
The interpretation of the NODE_DISTRIBUTION rows depends mainly on the VALUE TYPE column.
To exemplify the values, here is the distribution of one node from applying regression to the Iris data set. The target is PetalWidth, with SepalLength, SepalWidth and PetalLength as regressors:
- Two rows of the distribution describe the target continuous attribute. They can be recognized by their value type. The row having value type 1 (Missing) represents the statistics for the Missing state of the target attribute in the current node, while the row having value type 3 (Continuous) represents the statistics for the Existing state of the target attribute. If you do not have gaps in your data, than you can ignore the row with ValueType = 1. For the row with value type 3, ATTRIBUTE_NAME is the name of the target attribute (PetalWidth in my example), ATTRIBUTE_VALUE is the mean of the PetalWidth. You also get the support and variance. Support is the number of training casese in this node, Mean and Variance are computed only over the traiing cases that ended up in this node
- For each regressor, there are 3 distribution rows, having the valuetype, respectively: 7(coefficient), 8(Score gain), 9(Statistics). For all these 3 rows, ATTRIBUTE_NAME is the name of the regressor. Then:
for the row with Value Type 7 (Coefficient), ATTRIBUTE_VALUE is the regression coefficient associated with the regressor ('a' in y=ax+b).
Monday, March 12, 2012
Million Seperator
I am Facing Problem with The number Format. Instaed of Thosand Separator I want Million Separator..
For Eg: in Crsyal Report The Number will Display Like this 5,633,000.00. Instaed of This format I want this Number to be display Like 56,33,000.00. How i can Do that,,
Thanks in Advance
AmbilyUse Formula field having this code
stringvar Amount:="453453455.00";
stringvar s:=mid(Amount,1,len(Amount)-3);
select len(s)
case 3 : s & ".00"
case 4 : left(s,1) & "," & right(s,3)& ".00"
case 5 : left(s,2) & "," & right(s,3)& ".00"
case 6 : left(s,1) & "," & mid(s,2,2) & "," & right(s,3)& ".00"
case 7 : left(s,2) & "," & mid(s,2,2) & "," & right(s,3)& ".00"
case 8 : left(s,1) & "," & mid(s,2,2) & "," & mid(s,4,2) & "," & right(s,3)& ".00"
case 9 : left(s,2) & "," & mid(s,2,2) & "," & mid(s,4,2) & "," & right(s,3)& ".00"
case 10 : left(s,1) & "," & mid(s,2,2) & "," & mid(s,4,2) & "," & mid(s,6,2) & "," & right(s,3)& ".00"
default : s & ".00"
Madhivanan|||may i ask how to modify your script to get thousands separator?. i have case statement in my formula for differernt format. Don't want the .xx if they are both zeros.|||Hi 9e9+
Can you post the number and exepeted formated number?
Madhivanan|||Hi Madhi,
Thank you For your Fast Reply...
But i am Not Able to get the format..even though i analysed the function...but it is displaying The same format ,which crytsal report is giving.
Can u plz suggest any Other Function..|||Can you post the code you used?
Madhivanan|||Function (Currencyvar v1)
stringvar s:=mid(Totext(V1),2,len(Totext(V1))-4);
//stringvar str[100]=split(s,",");
//stringVar array str:=split(s,",");
//stringvar s=join(s2,",")
stringvar X:=mid(Totext(V1),Len(Totext(V1))-2,Len(Totext(V1)));
select len(S)
case 3 : s & X
case 4 : left(s,1) & "," & right(s,3)& X
case 5 : left(s,2) & "," & right(s,3)& X
case 6 : left(s,1) & "," & mid(s,2,2) & "," & right(s,3)&X
case 7 : left(s,2) & "," & mid(s,3,2) & "," & right(s,3)& X
case 8 : left(s,1) & "," & mid(s,2,2) & "," & mid(s,4,2) & "," & right(s,3)& X
case 9 : left(s,2) & "," & mid(s,3,2) & "," & mid(s,5,2) & "," & right(s,3)& X
case 10 : left(s,1) & "," & mid(s,2,2) & "," & mid(s,4,2) & "," & mid(s,6,2) & "," & right(s,3)& X
default : s & ".00" ;
This is the code i used. I rewrote the code bcecoz, By default The crystal report is taking $ symbol also with the Number format.
Now i am struggling becoz it will take the Thousand Seperator (,) also. So while taking leng\th , it will count The & symbol and Thousand seperator.
I dont want those...
So i am trying to Split the Number into array (,) and Join again with out Commas.
Can you help me.
I cant change the Reprt options again..coz already 150+ reports addaed..Now for all reports i hav to Update this Format..
or pls suggest me, any short cut method is available ...
Thanks
Ambily|||Hi Mr Madhi,
Thanks a Lot for ur Support.. The problem was Simple...But It troubled a Lot
I wrote A functon with ur code
Function (Currencyvar v1)
Numbervar A:=(Tonumber(V1));
stringvar s:=Totext(A);
stringvar X:=mid(Totext(V1),Len(Totext(V1))-2,Len(Totext(V1)));
select len(s)
case 3 : s & X
case 4 : left(s,1) & "," & right(s,3)& X
case 5 : left(s,2) & "," & right(s,3)& X
case 6 : left(s,1) & "," & mid(s,2,2) & "," & right(s,3)&X
case 7 : left(s,2) & "," & mid(s,3,2) & "," & right(s,3)& X
case 8 : left(s,1) & "," & mid(s,2,2) & "," & mid(s,4,2) & "," & right(s,3)& X
case 9 : left(s,2) & "," & mid(s,3,2) & "," & mid(s,4,2) & "," & right(s,3)& X
case 10 : left(s,1) & "," & mid(s,2,2) & "," & mid(s,4,2) & "," & mid(s,6,2) & "," & right(s,3)& X
default : s & ".00" ;
Now i am getting The currency format , which i need
Once again Thanks!!!
Ambily
Friday, March 9, 2012
Migration of SQLServer user databases to another SQLServer
I would like to migrate a number of user databases from one SQLSERVER (name:
LECOMMS02 - Windows NT - 5.0(2195), SQLServer 8.00.534(SP2)) to another (na
me: LEPIV01 - Windows NT - 5.0(2195), SQLServer 8.00.780(SP3)).
Please can you outline the steps involved and any pitfalls I should watch fo
r? I am new to SQLServer and this is live data. This needs completing today
as well!!
TIA, KenKen,
Have a look at:
INF: Moving SQL Server databases to a new location with Detach/Attach
http://support.microsoft.com/defaul...kb;EN-US;224071
Mark Allison, SQL Server MVP
Ken Jones wrote:
> Guys,
> I would like to migrate a number of user databases from one SQLSERVER (nam
e: LECOMMS02 - Windows NT - 5.0(2195), SQLServer 8.00.534(SP2)) to another (
name: LEPIV01 - Windows NT - 5.0(2195), SQLServer 8.00.780(SP3)).
> Please can you outline the steps involved and any pitfalls I should watch
for? I am new to SQLServer and this is live data. This needs completing toda
y as well!!
> TIA, Ken
>
Mark Allison, SQL Server MVP
http://www.allisonmitchell.com|||Hi,
Since you need to upgrade only the user databases you can do one of the
folowing
1. Detach and Attach databases
2. Backup and Restore the databases
1. Detach and Attach
a. Use SP_DETACH_DB to detach the MDF and LDF files
b. Copy the files to Destination server
c. Use SP_ATTACH_DB to attach the databases
(Refer books online for information)
2. Backup and Restore
a. Backup the source databases using BACKUP DATABASE command
b. Copy the .BAK files to destination
c. Restore the database using RESTORE DATABASE command
After this steps you may need to move the logins from source server to
destination server.
Have a look into the below link for information.
http://www.databasejournal.com/feat...cle.php/2228611
Thanks
Hari
MCDBA
"Ken Jones" <anonymous@.discussions.microsoft.com> wrote in message
news:1442724A-12BF-4AF2-8A02-B558DCA60658@.microsoft.com...
> Guys,
> I would like to migrate a number of user databases from one SQLSERVER
(name: LECOMMS02 - Windows NT - 5.0(2195), SQLServer 8.00.534(SP2)) to
another (name: LEPIV01 - Windows NT - 5.0(2195), SQLServer 8.00.780(SP3)).
> Please can you outline the steps involved and any pitfalls I should watch
for? I am new to SQLServer and this is live data. This needs completing
today as well!!
> TIA, Ken
>|||Mark,
So I can detach (using sp_detach) from the source database, ftp to new serve
r and then attach (using sp_attach)'
Is that all there is to it? Will the sp_attach alert master as to the appear
ance of x number of new user databases as I am moving from one SQLServer (li
ve) to a completely different, functioning SQLServer(live)?
TIA, Ken.|||Thanks for your swift replies - WOW!!|||Hi Hari,
Some of my files are .DAT files. Will this affect the detach and attach proc
ess?
TIA, Ken|||DAT files could mean they are 6.5 database files. You can't move such across
to 7.0/2000. You need to have those databases available in a 6.5 install and
use the upgrade wizard from there.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Ken Jones" <anonymous@.discussions.microsoft.com> wrote in message
news:40772738-BE5B-4C98-86D9-DE1DB7959FFB@.microsoft.com...
> Hi Hari,
> Some of my files are .DAT files. Will this affect the detach and attach
process?
> TIA, Ken|||"I would like to migrate a number of user databases from one SQLSERVER (name
: LECOMMS02 - Windows NT - 5.0(2195), SQLServer 8.00.534(SP2)) to another (n
ame: LEPIV01 - Windows NT - 5.0(2195), SQLServer 8.00.780(SP3))."
Both are SQLServer8 servers. I am going to try the sp_detach_db and sp_attac
h_db by ftp'ing the LDF and MDF files. I'll see if this works.
Ken|||OK I just mentioned the 6.5 stuff because in 6.5 DAT were the default
extension for both database and backup files.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Ken Jones" <anonymous@.discussions.microsoft.com> wrote in message
news:63CF9224-D4BF-4550-AF7E-4B139C9C1E69@.microsoft.com...
> "I would like to migrate a number of user databases from one SQLSERVER
(name: LECOMMS02 - Windows NT - 5.0(2195), SQLServer 8.00.534(SP2)) to
another (name: LEPIV01 - Windows NT - 5.0(2195), SQLServer 8.00.780(SP3))."
> Both are SQLServer8 servers. I am going to try the sp_detach_db and
sp_attach_db by ftp'ing the LDF and MDF files. I'll see if this works.
> Ken
Saturday, February 25, 2012
migrating with from access with VB scripts
Access 2000/2003, SQL server 2000If you have more than one channel open to the database server (a second "session", basically) then that may well appear to be "another user."|||doesn't seem to be, in my tracing, the issue seems to be that VB doesn't know that I'm the person makeing the changes. It looks like the VB script starts when the form opens, checks the contents of the record to be worked on and when the button is clicked, finds the contents have changed.|||Please post the code involved.