Showing posts with label convert. Show all posts
Showing posts with label convert. Show all posts

Friday, March 23, 2012

How convert UNICODE to datetime

Hi Everybody,

I have a column Fecha_Apertura int(4) that content data as 1157472771, and I need convert this to datetime.

Someone know of any script?

Thanks by your help

Do you know the format of the datetime value? How is it actually stored? Is it days from some fixed date? Or is it seconds and so on. What is the precision of the value? If we know the storage format then it is easy to write some series of expressions to convert it to datetime/smalldatetime.|||

This is probably "Unix time," or seconds after January 1, 1970.

To convert it, use DATEADD:

select dateadd(second,1157472771,'19700101')

This may be off by 22 seconds or so, because Unix time is supposed

to take leap seconds into account, something that SQL Server's dateadd

function does not do. If you can live with that bit of error, don't

worry about it. Otherwise, you'll have to find out the details of the

leap seconds and whether your values do account for them.

Steve Kass

Drew University

http://www.stevekass.com

Lisset@.discussions.microsoft.com wrote:

> Hi Everybody,

>

> I have a column Fecha_Apertura int(4) that content data as 1157472771,

> and I need convert this to datetime.

>

> Someone know of any script?

>

> Thanks by your help

>

>

>

>

>

>

How convert UNICODE to datetime

Hi Everybody,

I have a column Fecha_Apertura int(4) that content data as 1157472771, and I need convert this to datetime.

Someone know of any script?

Thanks by your help

Do you know the format of the datetime value? How is it actually stored? Is it days from some fixed date? Or is it seconds and so on. What is the precision of the value? If we know the storage format then it is easy to write some series of expressions to convert it to datetime/smalldatetime.|||

This is probably "Unix time," or seconds after January 1, 1970. To convert it, use DATEADD: select dateadd(second,1157472771,'19700101') This may be off by 22 seconds or so, because Unix time is supposed to take leap seconds into account, something that SQL Server's dateadd function does not do. If you can live with that bit of error, don't worry about it. Otherwise, you'll have to find out the details of the leap seconds and whether your values do account for them. Steve Kass Drew University http://www.stevekass.com Lisset@.discussions.microsoft.com wrote:
> Hi Everybody,
>
> I have a column Fecha_Apertura int(4) that content data as 1157472771,
> and I need convert this to datetime.
>
> Someone know of any script?
>
> Thanks by your help
>
>
>
>
>
>

How convert an named instance to a non named instance

Hello:
Our Application Vendor has now indicated that we need to have a non-named
instance because of their software and Analysis Services. How do we do this?
A named instance is a distinct copy of all of the sql server binaries, data
files, services, etc. If you want to put your data on the default instance,
you will need to backup your databases on the named instnace and restore them
onto the default instance. You can then use the sql server installation tool
to remove the named instance.
AndyP,
Sr. Database Administrator,
MCDBA 2003
"Victoria Morrison" wrote:

> Hello:
> Our Application Vendor has now indicated that we need to have a non-named
> instance because of their software and Analysis Services. How do we do this?
>
|||How do I create the default instance which is on the same server. I tried
it with the sql server installation and only lets you do a named instance.
When you say sql server installation tool you mean using the CD
"AndyP" wrote:
[vbcol=seagreen]
> A named instance is a distinct copy of all of the sql server binaries, data
> files, services, etc. If you want to put your data on the default instance,
> you will need to backup your databases on the named instnace and restore them
> onto the default instance. You can then use the sql server installation tool
> to remove the named instance.
> --
> AndyP,
> Sr. Database Administrator,
> MCDBA 2003
>
> "Victoria Morrison" wrote:
|||> How do I create the default instance which is on the same server.
By installing a default instance, i.e., the same setup process as when you installed the named
instance.

> I tried
> it with the sql server installation and only lets you do a named instance.
Then you already have a default instance.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Victoria Morrison" <VictoriaMorrison@.discussions.microsoft.com> wrote in message
news:4154AD5D-8E4A-420E-B013-9F0B94DFB787@.microsoft.com...[vbcol=seagreen]
> How do I create the default instance which is on the same server. I tried
> it with the sql server installation and only lets you do a named instance.
> When you say sql server installation tool you mean using the CD
> "AndyP" wrote:
|||That is what I tried, I put in the SQL Server CD and when it got to piece the
default was grayed out and would not let me click it. We have the instance
presently called "srvsql02\mptp" the vendor needs as a default "srvsql02". I
think 1) backup 2)uninstall 3) reinstall 4) restore each database starting
with master??
"Tibor Karaszi" wrote:

> By installing a default instance, i.e., the same setup process as when you installed the named
> instance.
>
> Then you already have a default instance.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Victoria Morrison" <VictoriaMorrison@.discussions.microsoft.com> wrote in message
> news:4154AD5D-8E4A-420E-B013-9F0B94DFB787@.microsoft.com...
>
>
|||> That is what I tried, I put in the SQL Server CD and when it got to piece the
> default was grayed out and would not let me click it.
That would happen if you already have a default instance. You can only have one default instance.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Victoria Morrison" <VictoriaMorrison@.discussions.microsoft.com> wrote in message
news:80C97B24-AC86-426E-955E-F57E2DBB9476@.microsoft.com...[vbcol=seagreen]
> That is what I tried, I put in the SQL Server CD and when it got to piece the
> default was grayed out and would not let me click it. We have the instance
> presently called "srvsql02\mptp" the vendor needs as a default "srvsql02". I
> think 1) backup 2)uninstall 3) reinstall 4) restore each database starting
> with master??
> "Tibor Karaszi" wrote:
|||Ok, so how do a rename it from srvsql01\mptp to simply srvsql01
"Tibor Karaszi" wrote:

> That would happen if you already have a default instance. You can only have one default instance.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Victoria Morrison" <VictoriaMorrison@.discussions.microsoft.com> wrote in message
> news:80C97B24-AC86-426E-955E-F57E2DBB9476@.microsoft.com...
>
>
|||Victoria Morrison wrote:
> Ok, so how do a rename it from srvsql01\mptp to simply srvsql01
>
You can't rename an instance, but in your case it sounds like you
already has a default instance. If you haven't got one already, you
should be able to install one. Since you say that this option is greyed
out, it indicates that it's already there.
Have you tried to connect to just srvsql01 in your application,
Enterprise Manager or Query Analyser? If you have, do you then get an
error message of some kind?
Regards
Steen
|||Thank all of you. It was grayed out on my Personnel copy, but when I tried
in on the test real enterprise version the options was not grayed out. And
thank for how to removed an instance that worked also. The only thing to
remember is that you have to put back the packs since the used the CD which
is at spack2. I did not know how else to get the install started. Now I
am going to detach and attach the the user databases and then add the login
user and my jobs. Since that path do not match restoring master did not
work.
"Steen Persson (DK)" wrote:

> Victoria Morrison wrote:
> You can't rename an instance, but in your case it sounds like you
> already has a default instance. If you haven't got one already, you
> should be able to install one. Since you say that this option is greyed
> out, it indicates that it's already there.
> Have you tried to connect to just srvsql01 in your application,
> Enterprise Manager or Query Analyser? If you have, do you then get an
> error message of some kind?
> Regards
> Steen
>
sql

How convert an named instance to a non named instance

Hello:
Our Application Vendor has now indicated that we need to have a non-named
instance because of their software and Analysis Services. How do we do this
?A named instance is a distinct copy of all of the sql server binaries, data
files, services, etc. If you want to put your data on the default instance,
you will need to backup your databases on the named instnace and restore the
m
onto the default instance. You can then use the sql server installation tool
to remove the named instance.
AndyP,
Sr. Database Administrator,
MCDBA 2003
"Victoria Morrison" wrote:

> Hello:
> Our Application Vendor has now indicated that we need to have a non-named
> instance because of their software and Analysis Services. How do we do th
is?
>|||How do I create the default instance which is on the same server. I tried
it with the sql server installation and only lets you do a named instance.
When you say sql server installation tool you mean using the CD
"AndyP" wrote:
[vbcol=seagreen]
> A named instance is a distinct copy of all of the sql server binaries, dat
a
> files, services, etc. If you want to put your data on the default instance
,
> you will need to backup your databases on the named instnace and restore t
hem
> onto the default instance. You can then use the sql server installation to
ol
> to remove the named instance.
> --
> AndyP,
> Sr. Database Administrator,
> MCDBA 2003
>
> "Victoria Morrison" wrote:
>|||> How do I create the default instance which is on the same server.
By installing a default instance, i.e., the same setup process as when you i
nstalled the named
instance.

> I tried
> it with the sql server installation and only lets you do a named instance.
Then you already have a default instance.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Victoria Morrison" <VictoriaMorrison@.discussions.microsoft.com> wrote in me
ssage
news:4154AD5D-8E4A-420E-B013-9F0B94DFB787@.microsoft.com...[vbcol=seagreen]
> How do I create the default instance which is on the same server. I trie
d
> it with the sql server installation and only lets you do a named instance.
> When you say sql server installation tool you mean using the CD
> "AndyP" wrote:
>|||That is what I tried, I put in the SQL Server CD and when it got to piece th
e
default was grayed out and would not let me click it. We have the instance
presently called "srvsql02\mptp" the vendor needs as a default "srvsql02".
I
think 1) backup 2)uninstall 3) reinstall 4) restore each database starting
with master'?
"Tibor Karaszi" wrote:

> By installing a default instance, i.e., the same setup process as when you
installed the named
> instance.
>
> Then you already have a default instance.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Victoria Morrison" <VictoriaMorrison@.discussions.microsoft.com> wrote in
message
> news:4154AD5D-8E4A-420E-B013-9F0B94DFB787@.microsoft.com...
>
>|||> That is what I tried, I put in the SQL Server CD and when it got to piece theen">
> default was grayed out and would not let me click it.
That would happen if you already have a default instance. You can only have
one default instance.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Victoria Morrison" <VictoriaMorrison@.discussions.microsoft.com> wrote in me
ssage
news:80C97B24-AC86-426E-955E-F57E2DBB9476@.microsoft.com...[vbcol=seagreen]
> That is what I tried, I put in the SQL Server CD and when it got to piece
the
> default was grayed out and would not let me click it. We have the instan
ce
> presently called "srvsql02\mptp" the vendor needs as a default "srvsql02".
I
> think 1) backup 2)uninstall 3) reinstall 4) restore each database starting
> with master'?
> "Tibor Karaszi" wrote:
>|||Ok, so how do a rename it from srvsql01\mptp to simply srvsql01
"Tibor Karaszi" wrote:

> That would happen if you already have a default instance. You can only hav
e one default instance.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Victoria Morrison" <VictoriaMorrison@.discussions.microsoft.com> wrote in
message
> news:80C97B24-AC86-426E-955E-F57E2DBB9476@.microsoft.com...
>
>|||Victoria Morrison wrote:
> Ok, so how do a rename it from srvsql01\mptp to simply srvsql01
>
You can't rename an instance, but in your case it sounds like you
already has a default instance. If you haven't got one already, you
should be able to install one. Since you say that this option is greyed
out, it indicates that it's already there.
Have you tried to connect to just srvsql01 in your application,
Enterprise Manager or Query Analyser? If you have, do you then get an
error message of some kind?
Regards
Steen|||Thank all of you. It was grayed out on my Personnel copy, but when I tried
in on the test real enterprise version the options was not grayed out. And
thank for how to removed an instance that worked also. The only thing to
remember is that you have to put back the packs since the used the CD which
is at spack2. I did not know how else to get the install started. Now
I
am going to detach and attach the the user databases and then add the login
user and my jobs. Since that path do not match restoring master did not
work.
"Steen Persson (DK)" wrote:

> Victoria Morrison wrote:
> You can't rename an instance, but in your case it sounds like you
> already has a default instance. If you haven't got one already, you
> should be able to install one. Since you say that this option is greyed
> out, it indicates that it's already there.
> Have you tried to connect to just srvsql01 in your application,
> Enterprise Manager or Query Analyser? If you have, do you then get an
> error message of some kind?
> Regards
> Steen
>

How convert an named instance to a non named instance

Hello:
Our Application Vendor has now indicated that we need to have a non-named
instance because of their software and Analysis Services. How do we do this?A named instance is a distinct copy of all of the sql server binaries, data
files, services, etc. If you want to put your data on the default instance,
you will need to backup your databases on the named instnace and restore them
onto the default instance. You can then use the sql server installation tool
to remove the named instance.
--
AndyP,
Sr. Database Administrator,
MCDBA 2003
"Victoria Morrison" wrote:
> Hello:
> Our Application Vendor has now indicated that we need to have a non-named
> instance because of their software and Analysis Services. How do we do this?
>|||How do I create the default instance which is on the same server. I tried
it with the sql server installation and only lets you do a named instance.
When you say sql server installation tool you mean using the CD
"AndyP" wrote:
> A named instance is a distinct copy of all of the sql server binaries, data
> files, services, etc. If you want to put your data on the default instance,
> you will need to backup your databases on the named instnace and restore them
> onto the default instance. You can then use the sql server installation tool
> to remove the named instance.
> --
> AndyP,
> Sr. Database Administrator,
> MCDBA 2003
>
> "Victoria Morrison" wrote:
> > Hello:
> > Our Application Vendor has now indicated that we need to have a non-named
> > instance because of their software and Analysis Services. How do we do this?
> >|||> How do I create the default instance which is on the same server.
By installing a default instance, i.e., the same setup process as when you installed the named
instance.
> I tried
> it with the sql server installation and only lets you do a named instance.
Then you already have a default instance.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Victoria Morrison" <VictoriaMorrison@.discussions.microsoft.com> wrote in message
news:4154AD5D-8E4A-420E-B013-9F0B94DFB787@.microsoft.com...
> How do I create the default instance which is on the same server. I tried
> it with the sql server installation and only lets you do a named instance.
> When you say sql server installation tool you mean using the CD
> "AndyP" wrote:
>> A named instance is a distinct copy of all of the sql server binaries, data
>> files, services, etc. If you want to put your data on the default instance,
>> you will need to backup your databases on the named instnace and restore them
>> onto the default instance. You can then use the sql server installation tool
>> to remove the named instance.
>> --
>> AndyP,
>> Sr. Database Administrator,
>> MCDBA 2003
>>
>> "Victoria Morrison" wrote:
>> > Hello:
>> > Our Application Vendor has now indicated that we need to have a non-named
>> > instance because of their software and Analysis Services. How do we do this?
>> >|||That is what I tried, I put in the SQL Server CD and when it got to piece the
default was grayed out and would not let me click it. We have the instance
presently called "srvsql02\mptp" the vendor needs as a default "srvsql02". I
think 1) backup 2)uninstall 3) reinstall 4) restore each database starting
with master'?
"Tibor Karaszi" wrote:
> > How do I create the default instance which is on the same server.
> By installing a default instance, i.e., the same setup process as when you installed the named
> instance.
>
> > I tried
> > it with the sql server installation and only lets you do a named instance.
> Then you already have a default instance.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Victoria Morrison" <VictoriaMorrison@.discussions.microsoft.com> wrote in message
> news:4154AD5D-8E4A-420E-B013-9F0B94DFB787@.microsoft.com...
> > How do I create the default instance which is on the same server. I tried
> > it with the sql server installation and only lets you do a named instance.
> > When you say sql server installation tool you mean using the CD
> >
> > "AndyP" wrote:
> >
> >> A named instance is a distinct copy of all of the sql server binaries, data
> >> files, services, etc. If you want to put your data on the default instance,
> >> you will need to backup your databases on the named instnace and restore them
> >> onto the default instance. You can then use the sql server installation tool
> >> to remove the named instance.
> >>
> >> --
> >> AndyP,
> >> Sr. Database Administrator,
> >> MCDBA 2003
> >>
> >>
> >> "Victoria Morrison" wrote:
> >>
> >> > Hello:
> >> > Our Application Vendor has now indicated that we need to have a non-named
> >> > instance because of their software and Analysis Services. How do we do this?
> >> >
>
>|||> That is what I tried, I put in the SQL Server CD and when it got to piece the
> default was grayed out and would not let me click it.
That would happen if you already have a default instance. You can only have one default instance.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Victoria Morrison" <VictoriaMorrison@.discussions.microsoft.com> wrote in message
news:80C97B24-AC86-426E-955E-F57E2DBB9476@.microsoft.com...
> That is what I tried, I put in the SQL Server CD and when it got to piece the
> default was grayed out and would not let me click it. We have the instance
> presently called "srvsql02\mptp" the vendor needs as a default "srvsql02". I
> think 1) backup 2)uninstall 3) reinstall 4) restore each database starting
> with master'?
> "Tibor Karaszi" wrote:
>> > How do I create the default instance which is on the same server.
>> By installing a default instance, i.e., the same setup process as when you installed the named
>> instance.
>>
>> > I tried
>> > it with the sql server installation and only lets you do a named instance.
>> Then you already have a default instance.
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>>
>> "Victoria Morrison" <VictoriaMorrison@.discussions.microsoft.com> wrote in message
>> news:4154AD5D-8E4A-420E-B013-9F0B94DFB787@.microsoft.com...
>> > How do I create the default instance which is on the same server. I tried
>> > it with the sql server installation and only lets you do a named instance.
>> > When you say sql server installation tool you mean using the CD
>> >
>> > "AndyP" wrote:
>> >
>> >> A named instance is a distinct copy of all of the sql server binaries, data
>> >> files, services, etc. If you want to put your data on the default instance,
>> >> you will need to backup your databases on the named instnace and restore them
>> >> onto the default instance. You can then use the sql server installation tool
>> >> to remove the named instance.
>> >>
>> >> --
>> >> AndyP,
>> >> Sr. Database Administrator,
>> >> MCDBA 2003
>> >>
>> >>
>> >> "Victoria Morrison" wrote:
>> >>
>> >> > Hello:
>> >> > Our Application Vendor has now indicated that we need to have a non-named
>> >> > instance because of their software and Analysis Services. How do we do this?
>> >> >
>>|||Ok, so how do a rename it from srvsql01\mptp to simply srvsql01
"Tibor Karaszi" wrote:
> > That is what I tried, I put in the SQL Server CD and when it got to piece the
> > default was grayed out and would not let me click it.
> That would happen if you already have a default instance. You can only have one default instance.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Victoria Morrison" <VictoriaMorrison@.discussions.microsoft.com> wrote in message
> news:80C97B24-AC86-426E-955E-F57E2DBB9476@.microsoft.com...
> > That is what I tried, I put in the SQL Server CD and when it got to piece the
> > default was grayed out and would not let me click it. We have the instance
> > presently called "srvsql02\mptp" the vendor needs as a default "srvsql02". I
> > think 1) backup 2)uninstall 3) reinstall 4) restore each database starting
> > with master'?
> >
> > "Tibor Karaszi" wrote:
> >
> >> > How do I create the default instance which is on the same server.
> >>
> >> By installing a default instance, i.e., the same setup process as when you installed the named
> >> instance.
> >>
> >>
> >> > I tried
> >> > it with the sql server installation and only lets you do a named instance.
> >>
> >> Then you already have a default instance.
> >> --
> >> Tibor Karaszi, SQL Server MVP
> >> http://www.karaszi.com/sqlserver/default.asp
> >> http://www.solidqualitylearning.com/
> >>
> >>
> >> "Victoria Morrison" <VictoriaMorrison@.discussions.microsoft.com> wrote in message
> >> news:4154AD5D-8E4A-420E-B013-9F0B94DFB787@.microsoft.com...
> >> > How do I create the default instance which is on the same server. I tried
> >> > it with the sql server installation and only lets you do a named instance.
> >> > When you say sql server installation tool you mean using the CD
> >> >
> >> > "AndyP" wrote:
> >> >
> >> >> A named instance is a distinct copy of all of the sql server binaries, data
> >> >> files, services, etc. If you want to put your data on the default instance,
> >> >> you will need to backup your databases on the named instnace and restore them
> >> >> onto the default instance. You can then use the sql server installation tool
> >> >> to remove the named instance.
> >> >>
> >> >> --
> >> >> AndyP,
> >> >> Sr. Database Administrator,
> >> >> MCDBA 2003
> >> >>
> >> >>
> >> >> "Victoria Morrison" wrote:
> >> >>
> >> >> > Hello:
> >> >> > Our Application Vendor has now indicated that we need to have a non-named
> >> >> > instance because of their software and Analysis Services. How do we do this?
> >> >> >
> >>
> >>
> >>
>
>|||Victoria Morrison wrote:
> Ok, so how do a rename it from srvsql01\mptp to simply srvsql01
>
You can't rename an instance, but in your case it sounds like you
already has a default instance. If you haven't got one already, you
should be able to install one. Since you say that this option is greyed
out, it indicates that it's already there.
Have you tried to connect to just srvsql01 in your application,
Enterprise Manager or Query Analyser? If you have, do you then get an
error message of some kind?
Regards
Steen|||Thank all of you. It was grayed out on my Personnel copy, but when I tried
in on the test real enterprise version the options was not grayed out. And
thank for how to removed an instance that worked also. The only thing to
remember is that you have to put back the packs since the used the CD which
is at spack2. I did not know how else to get the install started. Now I
am going to detach and attach the the user databases and then add the login
user and my jobs. Since that path do not match restoring master did not
work.
"Steen Persson (DK)" wrote:
> Victoria Morrison wrote:
> > Ok, so how do a rename it from srvsql01\mptp to simply srvsql01
> >
> You can't rename an instance, but in your case it sounds like you
> already has a default instance. If you haven't got one already, you
> should be able to install one. Since you say that this option is greyed
> out, it indicates that it's already there.
> Have you tried to connect to just srvsql01 in your application,
> Enterprise Manager or Query Analyser? If you have, do you then get an
> error message of some kind?
> Regards
> Steen
>

Wednesday, March 7, 2012

How can i use the formula in crystal report 8.5

Hello,
is there somebody who can help me to create a formula in crystal report 8.5.
this formula must convert a date ex : "01/01/1970 0:00" in unix format

I know the code in vb

rounddown( ((value +7200)/86400) + "01/01/1970"),0)

somebody can help me to do this with formula in crystale report

thansk for your cooperationhere after you will find the solution to convert a unix(UTC) time in to a normal date
DateAdd('s',{call_req.open_date},CDATETIME(1970,01,01,0,0,0))

Sunday, February 19, 2012

How can I test a connection string?

I'm trying to convert an application from MSDE to SQL2K. I am able execute the MSDE script to populate the SQL database and I've modified the .config file to point to the new db but it appears as though the web app is not connecting.
Is there a way I can test the connection string using Visual Studio or WebMatrix?
Thanks for helping!
ScottJust use any of the data wizards in Visual Studio and go through the create connection wizard