Showing posts with label saved. Show all posts
Showing posts with label saved. Show all posts

Tuesday, February 14, 2012

Cannot save a long string

This is what I am trying to save and what is actually being saved:

All variables are STRINGS.

Saving: 08:02:40 08:18:05 ^09:34:07 09:39:25 ^10:02:50 10:18:19 10:37:33 11:01:34 11:23:26 11:50:47 ^12:52:30 13:42:37 ^14:41:04 ^18:36:13
Saved: 08:02:40 08:18:05 ^09:34:07 09:39:25 ^10:02:50 10:

Saving: 08:08:52 08:59:55 ^09:38:04 09:54:20 ^10:15:37 10:34:40 10:39:02 11:12:45 11:39:33 ^12:18:51 13:11:24 ^14:04:52 15:18:43 ^19:13:10
Saved: 08:08:52 08:59:55 ^09:38:04 09:54:20 ^10:15:37 10:

The codes:

Table scripted to a query:

USE [Analytical]
GO
/****** Object: Table [dbo].[DailyTickMinMaxAnalysis] Script Date: 08/07/2007 15:44:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[DailyTickMinMaxAnalysis](
[symbol] [varchar](50) NOT NULL,
[cDate] [varchar](50) NOT NULL,
[part] [varchar](50) NOT NULL,
[collection] [varchar](max) NULL,
CONSTRAINT [remPat_Trades] PRIMARY KEY CLUSTERED
(
[symbol] ASC,
[cDate] ASC,
[part] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF

Stored procedure is:


USE [Analytical]
GO
/****** Object: StoredProcedure [dbo].[InsertDailyTickMinMaxAnalysis] Script Date: 08/07/2007 15:45:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO

ALTER PROCEDURE [dbo].[InsertDailyTickMinMaxAnalysis]
@.symbol varchar(50),
@.cDate varchar(50),
@.part varchar(50),
@.collection varchar(50) = NULL
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO dbo.DailyTickMinMaxAnalysis (
symbol,
cDate,
part,
[collection])
Values (
@.symbol,
@.cDate,
@.part,
@.collection)
END

C# procedure:

public void saveHistTickMinMaxAnalysis ( int tableIndex )
{
if ( tableIndex != -1 )
{
using ( SqlConnection conn_Analytical = new SqlConnection ( "server=ddmnvt61\\sqlexpress;" +
"database=Analytical;Trusted_Connection=Yes" ) )
{
SqlCommand cmdm = new SqlCommand ( );
conn_Analytical.Open ( );
cmdm.Connection = conn_Analytical;
cmdm.CommandType = CommandType.StoredProcedure;
cmdm.CommandText = "InsertDailyTickMinMaxAnalysis";
cmdm.Parameters.Clear ( );
cmdm.Parameters.Add ( "@.symbol", SqlDbType.VarChar, 50, "symbol" );
cmdm.Parameters.Add ( "@.cDate", SqlDbType.VarChar, 50, "cDate" );
cmdm.Parameters.Add ( "@.part", SqlDbType.VarChar, 50, "part" ); // 2
cmdm.Parameters.Add ( "@.collection", SqlDbType.VarChar, 500, "collection" ); // 3
foreach ( DataRow row in Globals.dtSets.Tables[tableIndex].Rows )
{
cmdm.Parameters[0].Value = ( string )row[0];
cmdm.Parameters[1].Value = ( string )row[1];
cmdm.Parameters[2].Value = ( string )row[2];
cmdm.Parameters[3].Value = ( string )row[3];
Console.WriteLine ( "Saving {0}", ( string )row[3] ); // <= where the print out occurs to confirm that the right string is being passed
try
{
cmdm.ExecuteNonQuery ( );
}
catch { }
}
}
}
} // saveHistTickMinMaxAnalysis

Table is defined with the last columns[3].Length = 500;

What happened to the rest of my strings?

I would appreciate any help.

Many thanks.

Your parameter in your procedure is only VARCHAR(50), therefor it is implictly cut to 50 chars.

Jens K. Suessmeyer


http://www.sqlserver2005.de

|||

Jens K. Suessmeyer wrote:

Your parameter in your procedure is only VARCHAR(50), therefor it is implictly cut to 50 chars.

Jens K. Suessmeyer


http://www.sqlserver2005.de

Thank you Jens.

I actually figured it out right after I posted the message but in the end I did a complete workaround even without SQL Server. Probably was very tired that day. Goofy!

Sunday, February 12, 2012

Cannot save a long string

This is what I am trying to save and what is actually being saved:

All variables are STRINGS.

Saving: 08:02:40 08:18:05 ^09:34:07 09:39:25 ^10:02:50 10:18:19 10:37:33 11:01:34 11:23:26 11:50:47 ^12:52:30 13:42:37 ^14:41:04 ^18:36:13
Saved: 08:02:40 08:18:05 ^09:34:07 09:39:25 ^10:02:50 10:

Saving: 08:08:52 08:59:55 ^09:38:04 09:54:20 ^10:15:37 10:34:40 10:39:02 11:12:45 11:39:33 ^12:18:51 13:11:24 ^14:04:52 15:18:43 ^19:13:10
Saved: 08:08:52 08:59:55 ^09:38:04 09:54:20 ^10:15:37 10:

The codes:

Table scripted to a query:

USE [Analytical]
GO
/****** Object: Table [dbo].[DailyTickMinMaxAnalysis] Script Date: 08/07/2007 15:44:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[DailyTickMinMaxAnalysis](
[symbol] [varchar](50) NOT NULL,
[cDate] [varchar](50) NOT NULL,
[part] [varchar](50) NOT NULL,
[collection] [varchar](max) NULL,
CONSTRAINT [remPat_Trades] PRIMARY KEY CLUSTERED
(
[symbol] ASC,
[cDate] ASC,
[part] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF

Stored procedure is:


USE [Analytical]
GO
/****** Object: StoredProcedure [dbo].[InsertDailyTickMinMaxAnalysis] Script Date: 08/07/2007 15:45:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO

ALTER PROCEDURE [dbo].[InsertDailyTickMinMaxAnalysis]
@.symbol varchar(50),
@.cDate varchar(50),
@.part varchar(50),
@.collection varchar(50) = NULL
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO dbo.DailyTickMinMaxAnalysis (
symbol,
cDate,
part,
[collection])
Values (
@.symbol,
@.cDate,
@.part,
@.collection)
END

C# procedure:

public void saveHistTickMinMaxAnalysis ( int tableIndex )
{
if ( tableIndex != -1 )
{
using ( SqlConnection conn_Analytical = new SqlConnection ( "server=ddmnvt61\\sqlexpress;" +
"database=Analytical;Trusted_Connection=Yes" ) )
{
SqlCommand cmdm = new SqlCommand ( );
conn_Analytical.Open ( );
cmdm.Connection = conn_Analytical;
cmdm.CommandType = CommandType.StoredProcedure;
cmdm.CommandText = "InsertDailyTickMinMaxAnalysis";
cmdm.Parameters.Clear ( );
cmdm.Parameters.Add ( "@.symbol", SqlDbType.VarChar, 50, "symbol" );
cmdm.Parameters.Add ( "@.cDate", SqlDbType.VarChar, 50, "cDate" );
cmdm.Parameters.Add ( "@.part", SqlDbType.VarChar, 50, "part" ); // 2
cmdm.Parameters.Add ( "@.collection", SqlDbType.VarChar, 500, "collection" ); // 3
foreach ( DataRow row in Globals.dtSets.Tables[tableIndex].Rows )
{
cmdm.Parameters[0].Value = ( string )row[0];
cmdm.Parameters[1].Value = ( string )row[1];
cmdm.Parameters[2].Value = ( string )row[2];
cmdm.Parameters[3].Value = ( string )row[3];
Console.WriteLine ( "Saving {0}", ( string )row[3] ); // <= where the print out occurs to confirm that the right string is being passed
try
{
cmdm.ExecuteNonQuery ( );
}
catch { }
}
}
}
} // saveHistTickMinMaxAnalysis

Table is defined with the last columns[3].Length = 500;

What happened to the rest of my strings?

I would appreciate any help.

Many thanks.

Your parameter in your procedure is only VARCHAR(50), therefor it is implictly cut to 50 chars.

Jens K. Suessmeyer


http://www.sqlserver2005.de

|||

Jens K. Suessmeyer wrote:

Your parameter in your procedure is only VARCHAR(50), therefor it is implictly cut to 50 chars.

Jens K. Suessmeyer


http://www.sqlserver2005.de

Thank you Jens.

I actually figured it out right after I posted the message but in the end I did a complete workaround even without SQL Server. Probably was very tired that day. Goofy!

Cannot restore from a UNC file in sql 2005 management studio

Hi,
In sql 2005 management studio, when I tried to restore a database from disk
file saved on a UNC path, I got the following error.
The Database Engine service could not resolve the specified file location.
Either the location does not exist, or the current login account does not
have access to it. Verify that the file location exists, and that the login
account has permissions on it.
The following are the options I selected:
Source for restore: From device
Backup media: File
Selected path: \\home.dept.some.edu\me\sql2005\backups\
Files of type: Backup Files (*.bak, *.trn)
File name: db.bak
The error showed up when I clicked OK to start the restore process.
In Start->Run, the UNC path opens fine. So it's not the permissions issue.
And the path exists. Do I have to restore using the 'restore' command
instead of using the management studio GUI interface if I want to restore
from UNC?
Thanks in advance,
Bing
The fully qualified domain name might be what is tripping it up - have you
tried specifying the IP address or using a non-qualified name. This is
assuming, of course, that this server is on the same domain that you're
trying to restore to...
"bing" wrote:

> Hi,
> In sql 2005 management studio, when I tried to restore a database from disk
> file saved on a UNC path, I got the following error.
> The Database Engine service could not resolve the specified file location.
> Either the location does not exist, or the current login account does not
> have access to it. Verify that the file location exists, and that the login
> account has permissions on it.
> The following are the options I selected:
> Source for restore: From device
> Backup media: File
> Selected path: \\home.dept.some.edu\me\sql2005\backups\
> Files of type: Backup Files (*.bak, *.trn)
> File name: db.bak
> The error showed up when I clicked OK to start the restore process.
> In Start->Run, the UNC path opens fine. So it's not the permissions issue.
> And the path exists. Do I have to restore using the 'restore' command
> instead of using the management studio GUI interface if I want to restore
> from UNC?
> Thanks in advance,
> Bing
|||Thanks for the response.
I tried the IP address, the same error.
The netwrok share and the sql 2005 server are not in the same domain.
Bing
"James Luetkehoelter" wrote:
[vbcol=seagreen]
> The fully qualified domain name might be what is tripping it up - have you
> tried specifying the IP address or using a non-qualified name. This is
> assuming, of course, that this server is on the same domain that you're
> trying to restore to...
> "bing" wrote:
|||"bing" <bing@.discussions.microsoft.com> wrote in message
news:18DF4B33-FFB8-49B7-9526-E6AB310FDB34@.microsoft.com...
> Thanks for the response.
> I tried the IP address, the same error.
> The netwrok share and the sql 2005 server are not in the same domain.
>
Actually this probably IS a permissions issue.
The user context that the SQL is operating in is most likely not the same as
the one you're logged into to run SMS.
[vbcol=seagreen]
> Bing
> "James Luetkehoelter" wrote:
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html
|||The SQLServer Service and SQL Agent windows services should always be set up
to login as domain-level accounts with appropriate permissions to access all
system-wide resources they may need access to. This especially includes
network file shares, which is almost certainly the problem here.
TheSQLGuru
President
Indicium Resources, Inc.
"bing" <bing@.discussions.microsoft.com> wrote in message
news:C2BD8088-BEE0-4581-9214-5D37F305118C@.microsoft.com...
> Hi,
> In sql 2005 management studio, when I tried to restore a database from
> disk
> file saved on a UNC path, I got the following error.
> The Database Engine service could not resolve the specified file location.
> Either the location does not exist, or the current login account does not
> have access to it. Verify that the file location exists, and that the
> login
> account has permissions on it.
> The following are the options I selected:
> Source for restore: From device
> Backup media: File
> Selected path: \\home.dept.some.edu\me\sql2005\backups\
> Files of type: Backup Files (*.bak, *.trn)
> File name: db.bak
> The error showed up when I clicked OK to start the restore process.
> In Start->Run, the UNC path opens fine. So it's not the permissions
> issue.
> And the path exists. Do I have to restore using the 'restore' command
> instead of using the management studio GUI interface if I want to restore
> from UNC?
> Thanks in advance,
> Bing

Cannot restore from a UNC file in sql 2005 management studio

Hi,
In sql 2005 management studio, when I tried to restore a database from disk
file saved on a UNC path, I got the following error.
The Database Engine service could not resolve the specified file location.
Either the location does not exist, or the current login account does not
have access to it. Verify that the file location exists, and that the login
account has permissions on it.
The following are the options I selected:
Source for restore: From device
Backup media: File
Selected path: \\home.dept.some.edu\me\sql2005\backups\
Files of type: Backup Files (*.bak, *.trn)
File name: db.bak
The error showed up when I clicked OK to start the restore process.
In Start->Run, the UNC path opens fine. So it's not the permissions issue.
And the path exists. Do I have to restore using the 'restore' command
instead of using the management studio GUI interface if I want to restore
from UNC?
Thanks in advance,
BingThe fully qualified domain name might be what is tripping it up - have you
tried specifying the IP address or using a non-qualified name. This is
assuming, of course, that this server is on the same domain that you're
trying to restore to...
"bing" wrote:

> Hi,
> In sql 2005 management studio, when I tried to restore a database from dis
k
> file saved on a UNC path, I got the following error.
> The Database Engine service could not resolve the specified file location.
> Either the location does not exist, or the current login account does not
> have access to it. Verify that the file location exists, and that the log
in
> account has permissions on it.
> The following are the options I selected:
> Source for restore: From device
> Backup media: File
> Selected path: \\home.dept.some.edu\me\sql2005\backups\
> Files of type: Backup Files (*.bak, *.trn)
> File name: db.bak
> The error showed up when I clicked OK to start the restore process.
> In Start->Run, the UNC path opens fine. So it's not the permissions issue
.
> And the path exists. Do I have to restore using the 'restore' command
> instead of using the management studio GUI interface if I want to restore
> from UNC?
> Thanks in advance,
> Bing|||Thanks for the response.
I tried the IP address, the same error.
The netwrok share and the sql 2005 server are not in the same domain.
Bing
"James Luetkehoelter" wrote:
[vbcol=seagreen]
> The fully qualified domain name might be what is tripping it up - have you
> tried specifying the IP address or using a non-qualified name. This is
> assuming, of course, that this server is on the same domain that you're
> trying to restore to...
> "bing" wrote:
>|||"bing" <bing@.discussions.microsoft.com> wrote in message
news:18DF4B33-FFB8-49B7-9526-E6AB310FDB34@.microsoft.com...
> Thanks for the response.
> I tried the IP address, the same error.
> The netwrok share and the sql 2005 server are not in the same domain.
>
Actually this probably IS a permissions issue.
The user context that the SQL is operating in is most likely not the same as
the one you're logged into to run SMS.
[vbcol=seagreen]
> Bing
> "James Luetkehoelter" wrote:
>
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html|||The SQLServer Service and SQL Agent windows services should always be set up
to login as domain-level accounts with appropriate permissions to access all
system-wide resources they may need access to. This especially includes
network file shares, which is almost certainly the problem here.
TheSQLGuru
President
Indicium Resources, Inc.
"bing" <bing@.discussions.microsoft.com> wrote in message
news:C2BD8088-BEE0-4581-9214-5D37F305118C@.microsoft.com...
> Hi,
> In sql 2005 management studio, when I tried to restore a database from
> disk
> file saved on a UNC path, I got the following error.
> The Database Engine service could not resolve the specified file location.
> Either the location does not exist, or the current login account does not
> have access to it. Verify that the file location exists, and that the
> login
> account has permissions on it.
> The following are the options I selected:
> Source for restore: From device
> Backup media: File
> Selected path: \\home.dept.some.edu\me\sql2005\backups\
> Files of type: Backup Files (*.bak, *.trn)
> File name: db.bak
> The error showed up when I clicked OK to start the restore process.
> In Start->Run, the UNC path opens fine. So it's not the permissions
> issue.
> And the path exists. Do I have to restore using the 'restore' command
> instead of using the management studio GUI interface if I want to restore
> from UNC?
> Thanks in advance,
> Bing

Cannot restore from a UNC file in sql 2005 management studio

Hi,
In sql 2005 management studio, when I tried to restore a database from disk
file saved on a UNC path, I got the following error.
The Database Engine service could not resolve the specified file location.
Either the location does not exist, or the current login account does not
have access to it. Verify that the file location exists, and that the login
account has permissions on it.
The following are the options I selected:
Source for restore: From device
Backup media: File
Selected path: \\home.dept.some.edu\me\sql2005\backups\
Files of type: Backup Files (*.bak, *.trn)
File name: db.bak
The error showed up when I clicked OK to start the restore process.
In Start->Run, the UNC path opens fine. So it's not the permissions issue.
And the path exists. Do I have to restore using the 'restore' command
instead of using the management studio GUI interface if I want to restore
from UNC?
Thanks in advance,
BingThe fully qualified domain name might be what is tripping it up - have you
tried specifying the IP address or using a non-qualified name. This is
assuming, of course, that this server is on the same domain that you're
trying to restore to...
"bing" wrote:
> Hi,
> In sql 2005 management studio, when I tried to restore a database from disk
> file saved on a UNC path, I got the following error.
> The Database Engine service could not resolve the specified file location.
> Either the location does not exist, or the current login account does not
> have access to it. Verify that the file location exists, and that the login
> account has permissions on it.
> The following are the options I selected:
> Source for restore: From device
> Backup media: File
> Selected path: \\home.dept.some.edu\me\sql2005\backups\
> Files of type: Backup Files (*.bak, *.trn)
> File name: db.bak
> The error showed up when I clicked OK to start the restore process.
> In Start->Run, the UNC path opens fine. So it's not the permissions issue.
> And the path exists. Do I have to restore using the 'restore' command
> instead of using the management studio GUI interface if I want to restore
> from UNC?
> Thanks in advance,
> Bing|||Thanks for the response.
I tried the IP address, the same error.
The netwrok share and the sql 2005 server are not in the same domain.
Bing
"James Luetkehoelter" wrote:
> The fully qualified domain name might be what is tripping it up - have you
> tried specifying the IP address or using a non-qualified name. This is
> assuming, of course, that this server is on the same domain that you're
> trying to restore to...
> "bing" wrote:
> > Hi,
> >
> > In sql 2005 management studio, when I tried to restore a database from disk
> > file saved on a UNC path, I got the following error.
> >
> > The Database Engine service could not resolve the specified file location.
> > Either the location does not exist, or the current login account does not
> > have access to it. Verify that the file location exists, and that the login
> > account has permissions on it.
> >
> > The following are the options I selected:
> >
> > Source for restore: From device
> > Backup media: File
> > Selected path: \\home.dept.some.edu\me\sql2005\backups\
> > Files of type: Backup Files (*.bak, *.trn)
> > File name: db.bak
> >
> > The error showed up when I clicked OK to start the restore process.
> >
> > In Start->Run, the UNC path opens fine. So it's not the permissions issue.
> > And the path exists. Do I have to restore using the 'restore' command
> > instead of using the management studio GUI interface if I want to restore
> > from UNC?
> >
> > Thanks in advance,
> >
> > Bing|||"bing" <bing@.discussions.microsoft.com> wrote in message
news:18DF4B33-FFB8-49B7-9526-E6AB310FDB34@.microsoft.com...
> Thanks for the response.
> I tried the IP address, the same error.
> The netwrok share and the sql 2005 server are not in the same domain.
>
Actually this probably IS a permissions issue.
The user context that the SQL is operating in is most likely not the same as
the one you're logged into to run SMS.
> Bing
> "James Luetkehoelter" wrote:
>> The fully qualified domain name might be what is tripping it up - have
>> you
>> tried specifying the IP address or using a non-qualified name. This is
>> assuming, of course, that this server is on the same domain that you're
>> trying to restore to...
>> "bing" wrote:
>> > Hi,
>> >
>> > In sql 2005 management studio, when I tried to restore a database from
>> > disk
>> > file saved on a UNC path, I got the following error.
>> >
>> > The Database Engine service could not resolve the specified file
>> > location.
>> > Either the location does not exist, or the current login account does
>> > not
>> > have access to it. Verify that the file location exists, and that the
>> > login
>> > account has permissions on it.
>> >
>> > The following are the options I selected:
>> >
>> > Source for restore: From device
>> > Backup media: File
>> > Selected path: \\home.dept.some.edu\me\sql2005\backups\
>> > Files of type: Backup Files (*.bak, *.trn)
>> > File name: db.bak
>> >
>> > The error showed up when I clicked OK to start the restore process.
>> >
>> > In Start->Run, the UNC path opens fine. So it's not the permissions
>> > issue.
>> > And the path exists. Do I have to restore using the 'restore' command
>> > instead of using the management studio GUI interface if I want to
>> > restore
>> > from UNC?
>> >
>> > Thanks in advance,
>> >
>> > Bing
--
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html|||The SQLServer Service and SQL Agent windows services should always be set up
to login as domain-level accounts with appropriate permissions to access all
system-wide resources they may need access to. This especially includes
network file shares, which is almost certainly the problem here.
--
TheSQLGuru
President
Indicium Resources, Inc.
"bing" <bing@.discussions.microsoft.com> wrote in message
news:C2BD8088-BEE0-4581-9214-5D37F305118C@.microsoft.com...
> Hi,
> In sql 2005 management studio, when I tried to restore a database from
> disk
> file saved on a UNC path, I got the following error.
> The Database Engine service could not resolve the specified file location.
> Either the location does not exist, or the current login account does not
> have access to it. Verify that the file location exists, and that the
> login
> account has permissions on it.
> The following are the options I selected:
> Source for restore: From device
> Backup media: File
> Selected path: \\home.dept.some.edu\me\sql2005\backups\
> Files of type: Backup Files (*.bak, *.trn)
> File name: db.bak
> The error showed up when I clicked OK to start the restore process.
> In Start->Run, the UNC path opens fine. So it's not the permissions
> issue.
> And the path exists. Do I have to restore using the 'restore' command
> instead of using the management studio GUI interface if I want to restore
> from UNC?
> Thanks in advance,
> Bing