Showing posts with label written. Show all posts
Showing posts with label written. Show all posts

Thursday, March 29, 2012

DB backup to a mapped drive on another server?

In SQL 2000, is it possible to perform a DB backup where the backup is
written to a disk drive on a different server. Someone had mentioned that
this is possible using backup devices (instead of backup files).
I tried adding a dump device with the following command:
sp_addumpdevice @.devtype = 'disk',
@.logicalname = 'SorClinTest_E',
@.physicalname = '\\RemoteServerName\e$\Backuptest\FromProd.ext'
When i tried backing up to that device i got an error that the backup failed
(no details). I am guessing that it failed because of the remote device.
If anyone can shed some light on this - I would appreciate it.
Thanks,
TomSee if this helps: http://vyaskn.tripod.com/administration_faq.htm#q17
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"TJT" <TJT@.nospam.com> wrote in message
news:OTIQNZTNFHA.1176@.TK2MSFTNGP12.phx.gbl...
In SQL 2000, is it possible to perform a DB backup where the backup is
written to a disk drive on a different server. Someone had mentioned that
this is possible using backup devices (instead of backup files).
I tried adding a dump device with the following command:
sp_addumpdevice @.devtype = 'disk',
@.logicalname = 'SorClinTest_E',
@.physicalname = '\\RemoteServerName\e$\Backuptest\FromProd.ext'
When i tried backing up to that device i got an error that the backup failed
(no details). I am guessing that it failed because of the remote device.
If anyone can shed some light on this - I would appreciate it.
Thanks,
Tom|||You don't need to add a dump device if you just want to backup the database
to another server.
BACKUP DATABASE dbname TO DISK = '\\server\share\filename'
"TJT" wrote:
> In SQL 2000, is it possible to perform a DB backup where the backup is
> written to a disk drive on a different server. Someone had mentioned that
> this is possible using backup devices (instead of backup files).
> I tried adding a dump device with the following command:
> sp_addumpdevice @.devtype = 'disk',
> @.logicalname = 'SorClinTest_E',
> @.physicalname = '\\RemoteServerName\e$\Backuptest\FromProd.ext'
> When i tried backing up to that device i got an error that the backup failed
> (no details). I am guessing that it failed because of the remote device.
> If anyone can shed some light on this - I would appreciate it.
> Thanks,
> Tom
>
>|||Hello Tom,
Check the login id the SQLServer service runs as and login to the server
with that ID and try to copy a file
into that share. If you cannot copy the file then you have a
access/permission problem ... etc.
ie, Can you copy a file to this location " \RemoteServerName\e$\Backuptest\
" using the login id that SQLServer
service runs with. Try this from command prompt.
Gopi
"TJT" <TJT@.nospam.com> wrote in message
news:OTIQNZTNFHA.1176@.TK2MSFTNGP12.phx.gbl...
> In SQL 2000, is it possible to perform a DB backup where the backup is
> written to a disk drive on a different server. Someone had mentioned that
> this is possible using backup devices (instead of backup files).
> I tried adding a dump device with the following command:
> sp_addumpdevice @.devtype = 'disk',
> @.logicalname = 'SorClinTest_E',
> @.physicalname = '\\RemoteServerName\e$\Backuptest\FromProd.ext'
> When i tried backing up to that device i got an error that the backup
> failed
> (no details). I am guessing that it failed because of the remote device.
> If anyone can shed some light on this - I would appreciate it.
> Thanks,
> Tom
>|||All The above are correct. I will add the idea of getting backup in a dump
device with Complete, differential, transactional backups to another server.
1. Create a map network drive
2. Restart your sql server in order to see the drive
3. Create a dump device via EM (It's easier) pointing the drive
4. Create the jobs you want.
Andreas
"Jack" wrote:
> You don't need to add a dump device if you just want to backup the database
> to another server.
> BACKUP DATABASE dbname TO DISK = '\\server\share\filename'
> "TJT" wrote:
> > In SQL 2000, is it possible to perform a DB backup where the backup is
> > written to a disk drive on a different server. Someone had mentioned that
> > this is possible using backup devices (instead of backup files).
> >
> > I tried adding a dump device with the following command:
> > sp_addumpdevice @.devtype = 'disk',
> > @.logicalname = 'SorClinTest_E',
> > @.physicalname = '\\RemoteServerName\e$\Backuptest\FromProd.ext'
> >
> > When i tried backing up to that device i got an error that the backup failed
> > (no details). I am guessing that it failed because of the remote device.
> >
> > If anyone can shed some light on this - I would appreciate it.
> >
> > Thanks,
> > Tom
> >
> >
> >

Tuesday, March 27, 2012

DB access works in debug but fails when hosted

I have written a intranet page that writes some info into a sql database, basically following the 'SQL Server 2005 Express for Beginners' video.

When I debug the application from within 'Visual Web Develop 2005 express' it works fine entries are entered into the DB and I can then edit the db using the admin page.

But when I host the site using IIS I doesn't work, submissions to the database seem to fail I can see the DB in the admin page but if I try to edit them or delete them it fails.

What could I doing wrong could I be missing a setting in IIS? Any ideas??

Here's my webconfig if that helps at all:

<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<connectionStrings>
<add name="studentprofilesConnectionString1" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\studentprofiles.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<roleManager defaultProvider="AspNetWindowsTokenRoleProvider" />
<compilation debug="true" defaultLanguage="c#" /></system.web></configuration

There is a posibility that if SQL server is not configured to accept remote connection it may fail. To enable remote connection follow this steps

Under SQL2005 program menu follow configuration Tools =>SQL Server Surface Area Configuration => Select Server Surface Area Configuration for Services and Connections.

It will lead to a window with a treeview select Remote connections.Then Select Local and Remote Connections.

Now if the error is due to Remote configuration issue it will be resolved

Monday, March 19, 2012

datetime JDBC date conversion

I am writing a datetime field value to MS SQL Server 7 in the following manner
via a stored procedure:

// item to be written is originally a java.util.Date object
java.util.Date fromDate;
// I'm inserting it here into the database
cstmt.setTimestamp(8, new Timestamp(fromDate.getTime()));

// the record in the database appears as follows - as I wanted it to..
12/23/2004 4:30:43 AM

The problem is reading the date FROM the database back into ANY type of Java
Date-related object. No matter what I try, the hour/minutes/seconds are not
returned, and I desperately need the hour and minutes. I don't want to store
the hours and minutes in another field - it just causes more complications.
Does anyone out there know a way to get the ENTIRE date value out of the database?Hi

Are you saying that getTime() returns 00:00:00 ?

Posting your the code that tries to retrive this may help!

John

"billb" <kmilburn@.austin.rr.com> wrote in message
news:3561fddb.0410261050.6c8bafba@.posting.google.c om...
> I am writing a datetime field value to MS SQL Server 7 in the following
manner
> via a stored procedure:
> // item to be written is originally a java.util.Date object
> java.util.Date fromDate;
> // I'm inserting it here into the database
> cstmt.setTimestamp(8, new Timestamp(fromDate.getTime()));
> // the record in the database appears as follows - as I wanted it to..
> 12/23/2004 4:30:43 AM
> The problem is reading the date FROM the database back into ANY type of
Java
> Date-related object. No matter what I try, the hour/minutes/seconds are
not
> returned, and I desperately need the hour and minutes. I don't want to
store
> the hours and minutes in another field - it just causes more
complications.
> Does anyone out there know a way to get the ENTIRE date value out of the
database?|||
billb wrote:

> I am writing a datetime field value to MS SQL Server 7 in the following manner
> via a stored procedure:
> // item to be written is originally a java.util.Date object
> java.util.Date fromDate;
> // I'm inserting it here into the database
> cstmt.setTimestamp(8, new Timestamp(fromDate.getTime()));
> // the record in the database appears as follows - as I wanted it to..
> 12/23/2004 4:30:43 AM
> The problem is reading the date FROM the database back into ANY type of Java
> Date-related object. No matter what I try, the hour/minutes/seconds are not
> returned, and I desperately need the hour and minutes. I don't want to store
> the hours and minutes in another field - it just causes more complications.
> Does anyone out there know a way to get the ENTIRE date value out of the database?

Are you sure you tried getTimestamp()?
Joe Weinstein at BEA|||billb wrote:
> I am writing a datetime field value to MS SQL Server 7 in the following manner
> via a stored procedure:
> // item to be written is originally a java.util.Date object
> java.util.Date fromDate;
> // I'm inserting it here into the database
> cstmt.setTimestamp(8, new Timestamp(fromDate.getTime()));
> // the record in the database appears as follows - as I wanted it to..
> 12/23/2004 4:30:43 AM
> The problem is reading the date FROM the database back into ANY type of Java
> Date-related object. No matter what I try, the hour/minutes/seconds are not
> returned, and I desperately need the hour and minutes. I don't want to store
> the hours and minutes in another field - it just causes more complications.
> Does anyone out there know a way to get the ENTIRE date value out of the database?

Convert DATETIME into CHARATER using MS SQL finction is SELECT statement:

CONVERT ( VARCHAR( length ), some_datetime_colimn, <style> )

where <style> is magic number which defines format( 120 ~ yyyy-mm-dd HH:mi:ss);

get value from ResultSet as string and parse it using

java.text.DateFormat.parseDate(...)|||Hi,

Please use the following to construct a full date object from database date
field.

java.util.Date myDate = new
java.util.Date(myResultSet.getTimestamp("myDate").getTime());

I hope this will help ..

Regards,
Yasir

"billb" <kmilburn@.austin.rr.com> wrote in message
news:3561fddb.0410261050.6c8bafba@.posting.google.c om...
> I am writing a datetime field value to MS SQL Server 7 in the following
manner
> via a stored procedure:
> // item to be written is originally a java.util.Date object
> java.util.Date fromDate;
> // I'm inserting it here into the database
> cstmt.setTimestamp(8, new Timestamp(fromDate.getTime()));
> // the record in the database appears as follows - as I wanted it to..
> 12/23/2004 4:30:43 AM
> The problem is reading the date FROM the database back into ANY type of
Java
> Date-related object. No matter what I try, the hour/minutes/seconds are
not
> returned, and I desperately need the hour and minutes. I don't want to
store
> the hours and minutes in another field - it just causes more
complications.
> Does anyone out there know a way to get the ENTIRE date value out of the
database?

Thursday, March 8, 2012

datetime Data Type

I am trying to insert dates and times into a SQL database using a small ASP
application I have just written to test it.
The dates are being passed in format: dd/mm/yyyy, and the times in format:
hh:mm:ss
However, when I set the fields as datatype datetime, it fails saying:
The conversion of a char data type to a datetime data type resulted in an
out-of-range datetime value.
What am I doing wrong? If I change the datatype of the field to char it
works fine, but I wanted them as datetime.
What do I need to change?
ThanksIf you want to that format, you need to have proper SET DATEFORMAT setting.
I suggest you read below article, and use a language neutral format.
http://www.karaszi.com/sqlserver/info_datetime.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Keith" <@..> wrote in message news:OFPuQX6CEHA.3280@.TK2MSFTNGP09.phx.gbl...
> I am trying to insert dates and times into a SQL database using a small
ASP
> application I have just written to test it.
> The dates are being passed in format: dd/mm/yyyy, and the times in format:
> hh:mm:ss
> However, when I set the fields as datatype datetime, it fails saying:
> The conversion of a char data type to a datetime data type resulted in an
> out-of-range datetime value.
> What am I doing wrong? If I change the datatype of the field to char it
> works fine, but I wanted them as datetime.
> What do I need to change?
> Thanks
>

Tuesday, February 14, 2012

Date_Time Convert(24) to DateTime Format

Please help me modify the sql statement so that I average wly values for
FullScan and CPU.
My Date_Time and samples are written to a table with the
char(24) format.
I need to convert the Date_Time field from char(24) to datetime format.
Please help me with this task.
Thanks,
Date_Time char(24)
2005-01-24 16:06:48.966
2005-01-24 16:07:48.966
2005-01-24 16:08:48.966
select
dateadd(hour,datediff(hour,'20040802',[d
ate_Time]),'20050202') as HourStart,
avg([Full_Scan_Sec]) as FullScan,
avg([CPU_Processor_Time]) as CPU
from Server_Data
where date_time BETWEEN '20040802' and '20050202'
group by dateadd(hour,datediff(hour,'20040802',[d
ate_Time]),'20040802')
order by dateadd(hour,datediff(hour,'20040802',[d
ate_Time]),'20050202')Joe
Have you tried CONVERT system function?
"Joe K." <Joe K.@.discussions.microsoft.com> wrote in message
news:42A097A1-85E1-4252-A39E-5A7320E65268@.microsoft.com...
> Please help me modify the sql statement so that I average wly values
for
> FullScan and CPU.
> My Date_Time and samples are written to a table with the
> char(24) format.
> I need to convert the Date_Time field from char(24) to datetime format.
> Please help me with this task.
> Thanks,
>
> Date_Time char(24)
> 2005-01-24 16:06:48.966
> 2005-01-24 16:07:48.966
> 2005-01-24 16:08:48.966
> select
> dateadd(hour,datediff(hour,'20040802',[d
ate_Time]),'20050202') as
HourStart,
> avg([Full_Scan_Sec]) as FullScan,
> avg([CPU_Processor_Time]) as CPU
> from Server_Data
> where date_time BETWEEN '20040802' and '20050202'
> group by dateadd(hour,datediff(hour,'20040802',[d
ate_Time]),'20040802')
> order by dateadd(hour,datediff(hour,'20040802',[d
ate_Time]),'20050202')
>|||I tried to convert the Date_Time from char(24) to smalldatetime received
syntax error.
select counterDateTime from CounterData (NOLOCK)
where convert(smalldatetime,counterdatetime)
Line 2: Incorrect syntax near ')'.
Please help me resolve this problem.
Thank You,
"Uri Dimant" wrote:

> Joe
> Have you tried CONVERT system function?
>
> "Joe K." <Joe K.@.discussions.microsoft.com> wrote in message
> news:42A097A1-85E1-4252-A39E-5A7320E65268@.microsoft.com...
> for
> HourStart,
>
>|||> select counterDateTime from CounterData (NOLOCK)
> where convert(smalldatetime,counterdatetime)
Abive is not a valid WHERE clause. It is similar to saying:
WHERE colname
A WHERE clause need some predicate, like:
WHERE colname = 23
What do you want to achieve? Return only the rows in where you have a string
in the column that can
be converted to datetime? If so, try:
WHERE ISDATE(counterdatetime) = 1
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"Joe K." <Joe K.@.discussions.microsoft.com> wrote in message
news:84F6AF1A-E00B-416D-95CB-F5A3C05054BD@.microsoft.com...
> I tried to convert the Date_Time from char(24) to smalldatetime received
> syntax error.
> select counterDateTime from CounterData (NOLOCK)
> where convert(smalldatetime,counterdatetime)
> Line 2: Incorrect syntax near ')'.
> Please help me resolve this problem.
> Thank You,
>
>
> "Uri Dimant" wrote:
>|||I'm trying to convert the DateTime column format from char(24) to
smalldatetime in a sql query. When it's in smalldatetime format then use the
average function to calculate average full_scan and CPU values.
The sql statements listed below.
Thank You,
"Tibor Karaszi" wrote:

> Abive is not a valid WHERE clause. It is similar to saying:
> WHERE colname
> A WHERE clause need some predicate, like:
> WHERE colname = 23
> What do you want to achieve? Return only the rows in where you have a stri
ng in the column that can
> be converted to datetime? If so, try:
> WHERE ISDATE(counterdatetime) = 1
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> http://www.sqlug.se/
>
> "Joe K." <Joe K.@.discussions.microsoft.com> wrote in message
> news:84F6AF1A-E00B-416D-95CB-F5A3C05054BD@.microsoft.com...
>
>|||I'm not sure exactly what your problem is. You posted a query in the origina
l post, but you didn't
say what happens when you run the query. Are you saying that below part fail
s? If so, what error
message do you get? Or incorrect results?
dateadd(hour,datediff(hour,'20040802',[d
ate_Time]),'20050202')
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"Joe K." <Joe K.@.discussions.microsoft.com> wrote in message
news:4D4CBFAA-70AB-498A-BBE4-3F9497793250@.microsoft.com...
> I'm trying to convert the DateTime column format from char(24) to
> smalldatetime in a sql query. When it's in smalldatetime format then use t
he
> average function to calculate average full_scan and CPU values.
> The sql statements listed below.
> Thank You,
>
> "Tibor Karaszi" wrote:
>

Date/Time Stamp

When a record is written to a table (via a asp form), I'd like the time
and date from the server to automatically populate a column in that
table. From what I can tell, timestamp isn't working. I rather not
have the time come from the client.

Thanks for the help.Add a column with a default of CURRENT_TIMESTAMP. This is nothing to do
with TIMESTAMP, which is the SQL Server keyword for a row-versioning
column, not for date and time.

ALTER TABLE your_table ADD date_created DATETIME NOT NULL
CONSTRAINT df_your_table_date_created DEFAULT CURRENT_TIMESTAMP

--
David Portas
SQL Server MVP
--|||alternatively, you can also use as

ALTER TABLE your_table ADD date_created DATETIME NOT NULL
CONSTRAINT df_your_table_date_created DEFAULT getdate()

best Regards,
Chandra
http://groups.msn.com/SQLResource/
http://chanduas.blogspot.com/
------------

*** Sent via Developersdex http://www.developersdex.com ***