Showing posts with label program. Show all posts
Showing posts with label program. Show all posts

Sunday, March 25, 2012

Change Filename creating database

I wish to change filename parameter depending on the root path of SQL Server :

C:\Program Files\Microsoft SQL Server\MSSQL.X\MSSQL where X>=1

I can find this root path by the following querie :

select SUBSTRING (physical_name,1,len(physical_name)-11) from sys.database_files where type_desc like 'LOG')

But i can't include the result in the create database command to be independant of the new root path in a the case of a deployment :

CREATE DATABASE [ACS] ON PRIMARY
(
NAME = N'ACS',
FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\ACS.mdf',
SIZE = 5120KB,
MAXSIZE = UNLIMITED,
FILEGROWTH = 1024KB
)
LOG ON
(
NAME = N'ACS_log',
FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\ACS_log.ldf',
SIZE = 3840KB,
MAXSIZE = 2048GB,
FILEGROWTH = 10%
)

Somebody can help me please ?

You will have to compose your SQlString first, then executing it with the help of sp_executesql or EXEC.

HTH; Jens K. Suessmeyer.

http://www.sqlserver2005.de|||

Following your clear but short instruction, i write the next queries that don't work, have a correction ?

DECLARE @.prmname nvarchar(500)
DECLARE @.prmname2 nvarchar(500)
DECLARE @.prmpath nvarchar(500)
DECLARE @.prmpath2 nvarchar(500)
DECLARE @.SQLString nvarchar(500)
DECLARE @.ParmDefinition nvarchar(500);

/* Build the SQL string */
SET @.SQLString =
N'CREATE DATABASE [ACS] ON PRIMARY
(
NAME = @.name,
FILENAME = @.path,
SIZE = 5120KB,
MAXSIZE = UNLIMITED,
FILEGROWTH = 1024KB
)
LOG ON
(
NAME = @.name2,
FILENAME = @.path2,
SIZE = 3840KB,
MAXSIZE = 2048GB,
FILEGROWTH = 10%
)
COLLATE Latin1_General_BIN2';
SET @.ParmDefinition = N'@.path varchar(500),@.path2 varchar(500), @.name varchar(500), , @.name2 varchar(500)';

/* Execute the string with the parameter value. */
SET @.prmname = N'ACS';
SET @.prmpath = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\ACS.mdf';
SET @.prmname2 = N'ACS_log';
SET @.prmpath2 = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\ACS_log.ldf';

EXECUTE sp_executesql
@.SQLString,
@.ParmDefinition,
@.name= @.prmname,@.path=@.prmpath, @.name2= @.prmname2,@.path2=@.prmpath2;

|||

DECLARE @.prmname nvarchar(500)

DECLARE @.prmname2 nvarchar(500)

DECLARE @.prmpath nvarchar(500)

DECLARE @.prmpath2 nvarchar(500)

DECLARE @.SQLString nvarchar(500)

DECLARE @.ParmDefinition nvarchar(500);

/* Execute the string with the parameter value. */

SET @.prmname = N'ACS';

SET @.prmpath = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\ACS.mdf';

SET @.prmname2 = N'ACS_log';

SET @.prmpath2 = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\ACS_log.ldf';

/* Build the SQL string */

SET @.SQLString =

N'CREATE DATABASE [ACS] ON PRIMARY

(

NAME = ' + @.prmname + ',

FILENAME = ' + @.prmpath + ',

SIZE = 5120KB,

MAXSIZE = UNLIMITED,

FILEGROWTH = 1024KB

)

LOG ON

(

NAME = ' + @.prmname2 + ',

FILENAME = ' + @.prmpath2 + ',

SIZE = 3840KB,

MAXSIZE = 2048GB,

FILEGROWTH = 10%

)

COLLATE Latin1_General_BIN2'

EXECUTE sp_executesql @.SQLString

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||

It's not working.

Incorrect Syntax for 'C' for DECLARE @.prmpath2 nvarchar(500)

Thursday, March 22, 2012

change default database path

Hi:

I'm usingSQL SERVER 2005 EXPRESS

My server name isSERVER1\SQLEXPRESS

When I create a new data base on my server it saves at

C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data

How Can I change this default path?

Thanks!!

Hi, you can take a look at theStep 3: Point your web.config file at the new SQL Databasesection in this article:

http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx

Change default data folder for MSSQL2000

Please can anyone tell me how I can change the default
location of the data folder for SQL2000?
For example it's currently
C:\Program Files\Microsoft SQL Server\MSSQL\Data
I want to change it so that each time a user creates a
database or a backup, the default location for the file to
be created is:
D:\MSSQL\
Can you help?
Thank youFrom Enterprise Mangler, right click the server name, select PROPERTIES.
Choose the Database Settings tab. Near the bottom are the fields for
default database and log file locations.
--
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Val" <anonymous@.discussions.microsoft.com> wrote in message
news:062501c3fae3$6c570bb0$a501280a@.phx.gbl...
> Please can anyone tell me how I can change the default
> location of the data folder for SQL2000?
> For example it's currently
> C:\Program Files\Microsoft SQL Server\MSSQL\Data
> I want to change it so that each time a user creates a
> database or a backup, the default location for the file to
> be created is:
> D:\MSSQL\
> Can you help?
> Thank you|||I found it - apologies
Knowledge base 272705
To change:
Right click your instance, SQL Server Properties, Database
settings tab, enter the location you want eg
D:\MSSQL
If only they were all so easy.|||Val
The default data directory is determined at the time SQL Server was
installed.
create database test
on
primary ( name=test,
filename='d:\my_test.mdf',
size=100mb,
maxsize=200,
filegrowth=20)
LOG on
(
name=test1,
filename='d:\my_test.ldf',
size=100mb,
maxsize=200,
filegrowth )
"Val" <anonymous@.discussions.microsoft.com> wrote in message
news:062501c3fae3$6c570bb0$a501280a@.phx.gbl...
> Please can anyone tell me how I can change the default
> location of the data folder for SQL2000?
> For example it's currently
> C:\Program Files\Microsoft SQL Server\MSSQL\Data
> I want to change it so that each time a user creates a
> database or a backup, the default location for the file to
> be created is:
> D:\MSSQL\
> Can you help?
> Thank you|||there is some sort of bug when you try and do this - you
cannot save the default location all the time.
>--Original Message--
>From Enterprise Mangler, right click the server name,
select PROPERTIES.
>Choose the Database Settings tab. Near the bottom are
the fields for
>default database and log file locations.
>--
>Geoff N. Hiten
>Microsoft SQL Server MVP
>Senior Database Administrator
>Careerbuilder.com
>I support the Professional Association for SQL Server
>www.sqlpass.org
>"Val" <anonymous@.discussions.microsoft.com> wrote in
message
>news:062501c3fae3$6c570bb0$a501280a@.phx.gbl...
>> Please can anyone tell me how I can change the default
>> location of the data folder for SQL2000?
>> For example it's currently
>> C:\Program Files\Microsoft SQL Server\MSSQL\Data
>> I want to change it so that each time a user creates a
>> database or a backup, the default location for the
file to
>> be created is:
>> D:\MSSQL\
>> Can you help?
>> Thank you
>
>.
>

Change default data folder for MSSQL2000

Please can anyone tell me how I can change the default
location of the data folder for SQL2000?
For example it's currently
C:\Program Files\Microsoft SQL Server\MSSQL\Data
I want to change it so that each time a user creates a
database or a backup, the default location for the file to
be created is:
D:\MSSQL\
Can you help?
Thank youFrom Enterprise Mangler, right click the server name, select PROPERTIES.
Choose the Database Settings tab. Near the bottom are the fields for
default database and log file locations.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Val" <anonymous@.discussions.microsoft.com> wrote in message
news:062501c3fae3$6c570bb0$a501280a@.phx.gbl...
> Please can anyone tell me how I can change the default
> location of the data folder for SQL2000?
> For example it's currently
> C:\Program Files\Microsoft SQL Server\MSSQL\Data
> I want to change it so that each time a user creates a
> database or a backup, the default location for the file to
> be created is:
> D:\MSSQL\
> Can you help?
> Thank you|||Val
The default data directory is determined at the time SQL Server was
installed.
create database test
on
primary ( name=test,
filename='d:\my_test.mdf',
size=100mb,
maxsize=200,
filegrowth=20)
LOG on
(
name=test1,
filename='d:\my_test.ldf',
size=100mb,
maxsize=200,
filegrowth=20
)
"Val" <anonymous@.discussions.microsoft.com> wrote in message
news:062501c3fae3$6c570bb0$a501280a@.phx.gbl...
> Please can anyone tell me how I can change the default
> location of the data folder for SQL2000?
> For example it's currently
> C:\Program Files\Microsoft SQL Server\MSSQL\Data
> I want to change it so that each time a user creates a
> database or a backup, the default location for the file to
> be created is:
> D:\MSSQL\
> Can you help?
> Thank you|||there is some sort of bug when you try and do this - you
cannot save the default location all the time.

>--Original Message--
>From Enterprise Mangler, right click the server name,
select PROPERTIES.
>Choose the Database Settings tab. Near the bottom are
the fields for
>default database and log file locations.
>--
>Geoff N. Hiten
>Microsoft SQL Server MVP
>Senior Database Administrator
>Careerbuilder.com
>I support the Professional Association for SQL Server
>www.sqlpass.org
>"Val" <anonymous@.discussions.microsoft.com> wrote in
message
>news:062501c3fae3$6c570bb0$a501280a@.phx.gbl...
file to
>
>.
>

Wednesday, March 7, 2012

Challenge with SQL Express Installation

I am having a problem with the installation of SQL Express. the uninstall program says that part of the Beta is still installed. then the uninstall program crashes with a syntax error saying that &nbsp; in wrong place. found it deleted it and then the program will not continue. i cant find any remnants of the beta but SQL Server express will not install!! Please help.

Check out the Setup log, it will give specific information about what components are still installed. If those components are not listed in Add/Remove Programs, you can uninstall them using:

msiexec -x <product ID>

Product ID will be listed in the setup log. This problem is discussed in detail in several other posts in this forum and in the Setup forum if you need more information.

Mike

|||where would i find the setup log?

Friday, February 24, 2012

CE10 - internal error - secLdap plugin

Hello

After installing the CE10 SDK on our IIS Server my program generates a CR report but only about 50% of the time - the error I get (which occurs when the program attampts to logon to the CE10 server) is :-

"An internal error has occurred in the secLdap plugin."

Our templates reside on a CE10 server. Another server contains our SDK and the code that calls the API. Has anyone received this before or does anyone have any ideas ?

My code to logon is as follows :-

SessionMgr ceSessionmgr = null;
EnterpriseSession ceSession;
Response.Expires = 0;
ceSessionmgr = new SessionMgr();
//Get username
user = Request.ServerVariables.Get("HTTP_PROXY_REMOTE_USER");
//Get password/token
password = Request.ServerVariables.Get("HTTP_LDAPTOKEN");
apsName = "NYITDCED001";
string apsAuthType = "secLDAP";
ceSession = ceSessionmgr.Logon(user, password, apsName, apsAuthType);

ceSessionmgr.Dispose();
ceSessionmgr = null;
ceSession.Logoff();
ceSession.Dispose();
ceSession = null;
...
...
...I have not received a reply to this so I am posting in "Business Objects:Crystal Enterprise"|||I have not received a reply to this so I am posting in "Business Objects:Crystal Enterprise"
Good. Hope you find the solution :)

CE upgrade tool?

Have anyone written a tool to upgrade from CE to Everywhere that is easier to use that the upgrade.exe program?

Thanks

Hi,
I have written a free GUI Interface to it - available at
http://www.gui-innovations.com/download/SqlUpgrade.zip

Pete

|||

Hello Pete,

Thanks for the link to your program.

I ran the program and got this error message:

SQLMobile appears not to be installed - can't continue. Cab files should be in the C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\SQL Server\Mobile\v3.0 folders on your PC

What product/SDK is it expecting?

Thanks

Tom

|||

Hi,

you will need the .Net CF 2 runtimes, and the SqlMobile runtimes on the PPC to run it

Pete

Tuesday, February 14, 2012

Catch and analyse incoming queries

Can I programatically (from f.e. c# program) catch incoming queries to
an SQL server?
I want to watch and analyse them, if such queries are
create/alter/drop I want to log this information in a database to view
changes history of database structure.
You can use profiler for these type of activities. I recollect reading on
Dejan blog to build a trigger on profiler based events. Can take a read at
: http://solidqualitylearning.com/blog...11/25/214.aspx
HTH,
Vinod Kumar
MCSE, DBA, MCAD, MCSD
http://www.extremeexperts.com
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
"Sergi" <adamchuk@.gmail.com> wrote in message
news:6f504b3b.0502250002.103d18a5@.posting.google.c om...
> Can I programatically (from f.e. c# program) catch incoming queries to
> an SQL server?
> I want to watch and analyse them, if such queries are
> create/alter/drop I want to log this information in a database to view
> changes history of database structure.