Showing posts with label application. Show all posts
Showing posts with label application. Show all posts

Friday, March 30, 2012

New to SQL Server

I am new to sql server, mostly work with an other product build by a company
in california. We can call it "company O"
We had a application written for our company. The version of SQL Server is
2000. They created all the objects owned by dbo. When I asked why, I was
told this is what Microsoft recommends. My question is why should the
objects be owned by dbo and not use the a model like
schema/username.objectname
Can some one explain why use the dbo as the owner of the objects in a
database vrs have a schema and then grant permissions on the objects in the
schema?In SQL Server 2000, schemas don't work that way. Having everything owned by
dbo makes it much easier to manage. SQL Server 2005 properly implements
schemas such that what you're talking about does make sense.
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--
"jbwest77" <jbwest77@.discussions.microsoft.com> wrote in message
news:1C71EE4D-A6F0-42BE-A48E-693830152596@.microsoft.com...
>I am new to sql server, mostly work with an other product build by a
>company
> in california. We can call it "company O"
> We had a application written for our company. The version of SQL Server
> is
> 2000. They created all the objects owned by dbo. When I asked why, I was
> told this is what Microsoft recommends. My question is why should the
> objects be owned by dbo and not use the a model like
> schema/username.objectname
> Can some one explain why use the dbo as the owner of the objects in a
> database vrs have a schema and then grant permissions on the objects in
> the
> schema?|||On Mon, 21 Nov 2005 15:48:01 -0800, "jbwest77"
<jbwest77@.discussions.microsoft.com> wrote:
>I am new to sql server, mostly work with an other product build by a company
>in california. We can call it "company O"
>We had a application written for our company. The version of SQL Server is
>2000. They created all the objects owned by dbo. When I asked why, I was
>told this is what Microsoft recommends. My question is why should the
>objects be owned by dbo and not use the a model like
>schema/username.objectname
>Can some one explain why use the dbo as the owner of the objects in a
>database vrs have a schema and then grant permissions on the objects in the
>schema?
It's just always been that way, and various tools and defaults are
very awkward if you try to use ownership other than dbo.
If things are finally better in Yukon, then we'll just have to break
old habits!
So, I'd say that at least on this issue, so far I wouldn't hold it
against your developers.
J.|||In SQL Server 2000 you can implement the schema/username.objectname that you
mentioned, more exactly the username. You can create a user, like finance,
and give ownership of the objects to that user. We have several applications
like that and we do not have any problem.
If you want to implement schemas Oracle-style then we have SQL Server 2005.
Ben Nevarez
"jbwest77" <jbwest77@.discussions.microsoft.com> wrote in message
news:1C71EE4D-A6F0-42BE-A48E-693830152596@.microsoft.com...
>I am new to sql server, mostly work with an other product build by a
>company
> in california. We can call it "company O"
> We had a application written for our company. The version of SQL Server
> is
> 2000. They created all the objects owned by dbo. When I asked why, I was
> told this is what Microsoft recommends. My question is why should the
> objects be owned by dbo and not use the a model like
> schema/username.objectname
> Can some one explain why use the dbo as the owner of the objects in a
> database vrs have a schema and then grant permissions on the objects in
> the
> schema?|||Thanks for the input.
"Ben Nevarez" wrote:
> In SQL Server 2000 you can implement the schema/username.objectname that you
> mentioned, more exactly the username. You can create a user, like finance,
> and give ownership of the objects to that user. We have several applications
> like that and we do not have any problem.
> If you want to implement schemas Oracle-style then we have SQL Server 2005.
> Ben Nevarez
>
> "jbwest77" <jbwest77@.discussions.microsoft.com> wrote in message
> news:1C71EE4D-A6F0-42BE-A48E-693830152596@.microsoft.com...
> >I am new to sql server, mostly work with an other product build by a
> >company
> > in california. We can call it "company O"
> >
> > We had a application written for our company. The version of SQL Server
> > is
> > 2000. They created all the objects owned by dbo. When I asked why, I was
> > told this is what Microsoft recommends. My question is why should the
> > objects be owned by dbo and not use the a model like
> > schema/username.objectname
> > Can some one explain why use the dbo as the owner of the objects in a
> > database vrs have a schema and then grant permissions on the objects in
> > the
> > schema?
>
>

Wednesday, March 28, 2012

new to crystal reports xi to use with vb6

I have crystal xi and i want to use it with vb6 application when i download source code examples no one works always differences in dlls
can someone just give me what dll should i use and if posible some example
i enclose the dll from some source code and the ones i try to use with no success thanks for help
ramon@.soler.com

report creation example

Object={3C62B3DD-12BE-4941-A787-EA25415DCD27}#10.0#0; crviewer.dll
Reference=*\G{23325710-7003-45DC-9B12-49FF312E9F1F}#a.0#0#..\..\..\..\Program Files\Common Files\Crystal Decisions\2.5\bin\craxddrt.dll#Crystal Reports ActiveX Designer Design and Runtime Library 10.0
Reference=*\G{00000200-0000-0010-8000-00AA006D2EA4}#2.0#0#..\..\..\..\Program Files\Common Files\system\ado\msado20.tlb#Microsoft ActiveX Data Objects 2.0 Library
Reference=*\G{405C5540-54BA-4352-8F27-8663CA6D6630}#1.0#0#..\..\..\..\Program Files\Common Files\Crystal Decisions\2.5\bin\crystalwizard.dll#Crystal Reports 10 Standard Wizard library
Reference=*\G{DBF72987-0B52-4F0B-A456-4CAE876EE792}#a.0#0#..\..\..\..\Program Files\Common Files\Crystal Decisions\2.5\bin\CRDesignerCtrl.DLL#Embeddable Crystal Reports Designer Control Library 10.0
Object={DBF72987-0B52-4F0B-A456-4CAE876EE792}#10.0#0; CRDesignerCtrl.DLL

simple viewer example

Reference=*\G{00000300-0000-0010-8000-00AA006D2EA4}#2.0#0#..\..\..\Program Files\Common Files\system\ado\msador15.dll#Microsoft ActiveX Data Objects Recordset 1.5 Library
Object={3C62B3DD-12BE-4941-A787-EA25415DCD27}#10.0#0; CRViewer.dll
Reference=*\G{76691052-244D-4C07-8ECA-9FA4F1A25263}#a.0#0#..\..\..\Program Files\Common Files\Crystal Decisions\2.5\bin\craxdrt.dll#Crystal Reports ActiveX Designer Run Time Library 10.0

added to try to view this examples but do not work

Reference=*\G{FB992564-9055-42B5-B433-FEA84CEA93C4}#b.0#0#..\CRViewer.dll#Crystal ActiveX Report Viewer Library 11.0
Reference=*\G{418F8E14-9E24-4057-A167-82A54E9B695B}#1.0#0#C:\Archivos de programa\Archivos comunes\Business Objects\3.0\bin\Cdo32.dll#Crystal Data Object Library 2.7
Reference=*\G{EFA3761F-4265-4464-A2DE-519B8E7E34ED}#b.0#0#C:\Archivos de programa\Archivos comunes\Business Objects\3.0\bin\craxdrt.dll#Crystal Reports ActiveX Designer Run Time Library 11.0
Reference=*\G{2A75196C-D9EB-4129-B803-931327F72D5C}#2.8#0#C:\Archivos de programa\Archivos comunes\System\ADO\msado15.dll#Microsoft ActiveX Data Objects 2.8 Library
Reference=*\G{52A44D15-DEEF-498D-945F-3F50102E042A}#1.0#0#C:\Archivos de programa\Business Objects\BusinessObjects Enterprise 11\win32_x86\plugins\desktop\CrystalEnterprise.LicenseKey\LicenseKey.dll#Crystal Enterprise LicenseKey PlugIn 11.0
Reference=*\G{BD2383E5-593B-47CC-854B-1E227C0DDA33}#1.0#0#C:\Archivos de programa\Business Objects\BusinessObjects Enterprise 11\win32_x86\plugins\desktop\CrystalEnterprise.Program\Program.dll#Crystal Enterprise Program PlugIn 11.0
Object={00025600-0000-0000-C000-000000000046}#4.6#0; crystl32.ocx

i have crystal reports xiSee if you are able to find solution here
www.businessobjects.com

Friday, March 23, 2012

New SQL Server 2005 JDBC 1.0 & Visual J++

We have a legacy Java application that we maintain in Visual J++; we are
moving to SQL Server 2005 and would like to switch it from an old WebLogic
JDBC driver to the new Microsoft SQL Server 2005 JDBC Driver.
However, we're noticing strange behavior with regard to instantiating the
"com.microsoft.sqlserver.jdbc.SQLServerDriver" class (no class def found
errors even though the sqljdbc.jar file is specified on the correct path in
the Classpath environment variable, and using FileMon we can see the app
finding the file).
I assume this means that we're running under the old, and unsupported,
Microsoft Java VM. Is it possible this VM does not support the new JDBC
driver?
Steven Bras
Tessitura Network, Inc.
Hi Steven,
Thank you for posting.
Regarding on the SQL Server 2005 JDBC driver, it is built against the SUN
J2se sdk 1.4 while the Microsoft's VJ++ jvm has already stoped updating, so
it dosn't support new built java components. I suggest you tried testing
the JDBC driver through standard SUN J2SE SDK to see whether it works. For
VJ++ we may consider using the OLEDB COM interface to access the SQL Server.
Regards,
Steven Cheng
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
|||Thanks for your response; can you point me to samples of how to use ole db in
java?
Steven Bras
Tessitura Network, Inc.
"Steven Cheng[MSFT]" wrote:

> Hi Steven,
> Thank you for posting.
> Regarding on the SQL Server 2005 JDBC driver, it is built against the SUN
> J2se sdk 1.4 while the Microsoft's VJ++ jvm has already stoped updating, so
> it dosn't support new built java components. I suggest you tried testing
> the JDBC driver through standard SUN J2SE SDK to see whether it works. For
> VJ++ we may consider using the OLEDB COM interface to access the SQL Server.
> Regards,
> Steven Cheng
> Microsoft Online Community Support
>
> ==================================================
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
>
>
|||Thanks for your response Steven,
I'm not quite sure about a complete example on connecting database through
OLEDB provider in VJ++, I think it'll be better to post in some VJ++ or
data accessing specific newsgroup. Also, have you any plan on migrating the
program to pure .net framework so that we have more choice on data
accessing to SQL Server?
Regards,
Steven Cheng
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

New SQL Server 2005 JDBC 1.0 & Visual J++

We have a legacy Java application that we maintain in Visual J++; we are
moving to SQL Server 2005 and would like to switch it from an old WebLogic
JDBC driver to the new Microsoft SQL Server 2005 JDBC Driver.
However, we're noticing strange behavior with regard to instantiating the
"com.microsoft.sqlserver.jdbc.SQLServerDriver" class (no class def found
errors even though the sqljdbc.jar file is specified on the correct path in
the Classpath environment variable, and using FileMon we can see the app
finding the file).
I assume this means that we're running under the old, and unsupported,
Microsoft Java VM. Is it possible this VM does not support the new JDBC
driver?
Steven Bras
Tessitura Network, Inc.Hi Steven,
Thank you for posting.
Regarding on the SQL Server 2005 JDBC driver, it is built against the SUN
J2se sdk 1.4 while the Microsoft's VJ++ jvm has already stoped updating, so
it dosn't support new built Java components. I suggest you tried testing
the JDBC driver through standard SUN J2SE SDK to see whether it works. For
VJ++ we may consider using the OLEDB COM interface to access the SQL Server.
Regards,
Steven Cheng
Microsoft Online Community Support
========================================
==========
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
==========
This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)|||Thanks for your response; can you point me to samples of how to use ole db i
n
java?
--
Steven Bras
Tessitura Network, Inc.
"Steven Cheng[MSFT]" wrote:

> Hi Steven,
> Thank you for posting.
> Regarding on the SQL Server 2005 JDBC driver, it is built against the SUN
> J2se sdk 1.4 while the Microsoft's VJ++ jvm has already stoped updating, s
o
> it dosn't support new built Java components. I suggest you tried testing
> the JDBC driver through standard SUN J2SE SDK to see whether it works. For
> VJ++ we may consider using the OLEDB COM interface to access the SQL Serve
r.
> Regards,
> Steven Cheng
> Microsoft Online Community Support
>
> ========================================
==========
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ========================================
==========
>
> This posting is provided "AS IS" with no warranties, and confers no rights
.
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
>
>|||Thanks for your response Steven,
I'm not quite sure about a complete example on connecting database through
OLEDB provider in VJ++, I think it'll be better to post in some VJ++ or
data accessing specific newsgroup. Also, have you any plan on migrating the
program to pure .net framework so that we have more choice on data
accessing to SQL Server?
Regards,
Steven Cheng
Microsoft Online Community Support
========================================
==========
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
==========
This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Wednesday, March 21, 2012

New SQL Query Issue...

Hello all,

Well I guess with any good application making comes SQL query problems as one trys to out-do what they did before. In any case, I am having an issue with sorting again, but this time its for a new field.

I have three tables, "Projects", "Users", and "Groups". Now the problem is this... a user can own a project, or a user could belong to a group, which owns the project. Whatever the case, a project will be owned by EITHER a group, or user, not both. So, when looping my Projects recordset, I have a second recordset that figures out if the GroupID is null in the Projects table, and if it is, it looks up the User's name in the Users table. If the GroupID isn't null, it grabs the Group name from the Group's table.

The problem is, I want to be able to do nice sorting with only one recordset? Is that possible?


ID Project Title Owner
1 Test Project XYZ Enterprises, Inc.
2 Another Project John Doe
3 Something Else Microsoft, Inc.

Thanks again!
TylerYou should be able to gather all of the data using one query and a CASE statement. I am assuming you have a UserID in your Projects table:


SELECT
Projects.ID,
Projects.Title,
CASE
WHEN Projects.GroupID IS NOT NULL THEN Groups.Name
ELSE
Users.Name
END AS Owner
FROM
Projects
LEFT OUTER JOIN
Groups ON Projects.GroupID = Groups.GroupID
LEFT OUTER JOIN
Users ON Projects.UserID = Users.UserID
ORDER BY
Projects.ID

Terri|||I will give that a shot! Thanks for introducing me to new SQL keywords. Do you have a site that I could resource to learn more about making complicated queries? It seems like I have to make them more and more.

Also, I have a third issue. In addition to the "Projects" and "Tasks" table that I'm sure your all too familiar with, I have a third level down called "Hours"... Now, this is the most complicated thing ever, so I doubt it is possible. But, I want to be able to pull out the earliest StartDate in the Hours table, and the last EndDate in the Hours table. And the hours table related to the "Tasks" table with the TaskID in both tables, and the "Tasks" relate to the "Projects" with the ProjectID in both tables. So, basically I want to look the Projects recordset, showing the Start and End dates for that project. Is that possible? It would have to be the highest and lowest dates. Not sure how to do all that action, especially while keeping the COALEASE thing, and this thing above!!

Thanks again,
B|||Ok, so my new SQL statement works, and looks like this so far:


SELECT Projects.*, Managers.LastName AS ManagersLastName, Managers.FirstName AS ManagersFirstName,
ROUND(COALESCE (SUM(Tasks.TaskStatusPercent) / COUNT(Tasks.TaskID), 0), 0) AS Status, CASE WHEN Projects.GroupID IS NOT NULL
THEN Groups.GroupName ELSE Users.FirstName END AS Client
FROM Projects INNER JOIN
Users Managers ON Projects.ManagerID = Managers.UserID LEFT OUTER JOIN
Users ON Projects.UserID = Users.UserID LEFT OUTER JOIN
Groups ON Projects.GroupID = Groups.GroupID LEFT OUTER JOIN
Tasks ON Tasks.ProjectID = Projects.ProjectID
GROUP BY Projects.ProjectID, Projects.UserID, Projects.GroupID, Projects.ManagerID, Projects.StatusID, Projects.StatusPercent, Projects.ProjectTitle,
Projects.ProjectURL, Projects.ProjectDescription, Projects.DateStarted, Projects.DateEnded, Managers.LastName, Managers.FirstName,
Users.FirstName, Groups.GroupName

The only problem is, instead of having just Users.FirstName, I would like the "Client" field to be "Users.LastName, Users.FirstName", with the comma and space in there. Can I do that in SQL too?

Also, if you could figure out the issue with the Hours.StartDate and Hours.EndDate, that would be the last thing I would need!

Thanks again,
B|||Ok, so I found out if you do...


RTrim(Users.LastName) + ', ' + LTrim(Users.FirstName) END AS Client

... it will work. Now, I just have to figure out that StartDate, EndDate issue.

- B|||Woo-hoo, you're almost there! I believe all you need for the StartDate and EndDate are a MIN and a MAX in your column list, and a LEFT OUTER JOIN to the Hours table.


SELECT Projects.*, Managers.LastName AS ManagersLastName, Managers.FirstName AS ManagersFirstName,
ROUND(COALESCE (SUM(Tasks.TaskStatusPercent) / COUNT(Tasks.TaskID), 0), 0) AS Status, CASE WHEN Projects.GroupID IS NOT NULL
THEN Groups.GroupName ELSE RTrim(Users.LastName) + ', ' + LTrim(Users.FirstName) END AS Client,
MIN(Hours.StartDate) AS StartDate,
MAX(Hours.EndDate) AS EndDate
FROM Projects INNER JOIN
Users Managers ON Projects.ManagerID = Managers.UserID LEFT OUTER JOIN
Users ON Projects.UserID = Users.UserID LEFT OUTER JOIN
Groups ON Projects.GroupID = Groups.GroupID LEFT OUTER JOIN
Tasks ON Tasks.ProjectID = Projects.ProjectID LEFT OUTER JOIN
Hours ON Tasks.TaskID = Hours.TaskID
GROUP BY Projects.ProjectID, Projects.UserID, Projects.GroupID, Projects.ManagerID, Projects.StatusID, Projects.StatusPercent, Projects.ProjectTitle,
Projects.ProjectURL, Projects.ProjectDescription, Projects.DateStarted, Projects.DateEnded, Managers.LastName, Managers.FirstName,
Users.FirstName, Groups.GroupName

Terri

Friday, March 9, 2012

new login ID issue

I migrated a SQL 2005 db from our development server to our QA server. I created a new ID for the application to use on the QA SQL server. The problem I'm facing is, I can't connect using the ID I created or even the ID that was already in the db on the test server. I did a backup of the DB on the test server, did a restore on the QA server and the ID's will not connect. I keep getting 'login failed for username'

The username is under the security tab of SQL, and I have it pointing to the DB that it will be connected to, but no success.

Any ideas on what could be causing this to fail?

Sorry, I accidently posted my reply as a new post :-(

For the existing ID, the reason is does not work is probably due to the fact it is an "orphan". Userid information in SQL exists in 2 places, the system database master, and in the application database. So, when you restored the application database, the userid does not have a corresponding entry in the master system database, so it is an orphan. Go here to read more http://support.microsoft.com/kb/274188/

The issue with the newly-created account is more likely due to something you did wrong. Here are some things to check:

1. verify the default database for the userid is correct

2. check the "user mapping" for the userid - does it have at least the public role on the database?

It should have db_datareader also, and maybe db_datawriter, depending on its intended use

3. test your odbc connection, there is a test button to verify it is working

good luck.

|||

I've done all of that.

I even backed up the db and restored it to a fresh SQL server that had no Db's or ID's on it. And I still can't connect to it. I'm only able to connect to the database on the SQL server it was created on.

|||

This does seem strange. Lets ignore the old Login for now as we'd expect that not to be able to access the new database due to the orphaned user issue mentioned previously.


Could you confirm how you created the new login/user? Is the new login enabled (check status tab in SSMS) and double check the new password :-)

If all that looks fine, would you possibly be able to script out the CREATE LOGIN statement from SSMS and also the CREATE USER statement from SSMS and post them here. Might help troubleshoot.

|||

I got it to work, but only after I added the domain username by using SQL Auth and I dont want that. I want to use my windows id and password so its like

domain\username;password

when i do that I get [username] not associated with a trusted connection.

|||

How are you trying to connect to sql server? Via SSMS or through an application? If through an app, what is your connection string?

|||

On the second part of your explanation, it seems like you are trying to use Windows credentials (domain\login;passwordWink as part of the connection string. If my assumption is correct, then it would explain the “not associated with a trusted connection” error.

Windows authentication uses the Windows credentials used to establish the connection, if you need to switch to a different set of credentials (i.e. run as a different user), you will need to impersonate the Windows user first (i.e. using runas).

For the invalid ID issue, I am also surprised that the suggestion by z-on didn’t work. We will need more information in order to help.

· What is the error message that you are getting back

· Does it fail when connecting using sqlcmd as well?

· Does it fail on connections made on the same machine?

· Assuming the user Is the a Windows principal (please correct me if I am wrong)

· Is it a domain or a local machine Windows user

o If it I s a domain user, does the new system has access to the domain

o Does the service account used for SQL Server has proper permissions on the domain

· Does it have access to the system via Windows role membership (i.e. member of sysadmin group) or directly.

Thanks,

-Raul Garcia

SDE/T

SQL Server Engine

new login ID issue

I migrated a SQL 2005 db from our development server to our QA server. I created a new ID for the application to use on the QA SQL server. The problem I'm facing is, I can't connect using the ID I created or even the ID that was already in the db on the test server. I did a backup of the DB on the test server, did a restore on the QA server and the ID's will not connect. I keep getting 'login failed for username'

The username is under the security tab of SQL, and I have it pointing to the DB that it will be connected to, but no success.

Any ideas on what could be causing this to fail?

Sorry, I accidently posted my reply as a new post :-(

For the existing ID, the reason is does not work is probably due to the fact it is an "orphan". Userid information in SQL exists in 2 places, the system database master, and in the application database. So, when you restored the application database, the userid does not have a corresponding entry in the master system database, so it is an orphan. Go here to read more http://support.microsoft.com/kb/274188/

The issue with the newly-created account is more likely due to something you did wrong. Here are some things to check:

1. verify the default database for the userid is correct

2. check the "user mapping" for the userid - does it have at least the public role on the database?

It should have db_datareader also, and maybe db_datawriter, depending on its intended use

3. test your odbc connection, there is a test button to verify it is working

good luck.

|||

I've done all of that.

I even backed up the db and restored it to a fresh SQL server that had no Db's or ID's on it. And I still can't connect to it. I'm only able to connect to the database on the SQL server it was created on.

|||

This does seem strange. Lets ignore the old Login for now as we'd expect that not to be able to access the new database due to the orphaned user issue mentioned previously.


Could you confirm how you created the new login/user? Is the new login enabled (check status tab in SSMS) and double check the new password :-)

If all that looks fine, would you possibly be able to script out the CREATE LOGIN statement from SSMS and also the CREATE USER statement from SSMS and post them here. Might help troubleshoot.

|||

I got it to work, but only after I added the domain username by using SQL Auth and I dont want that. I want to use my windows id and password so its like

domain\username;password

when i do that I get [username] not associated with a trusted connection.

|||

How are you trying to connect to sql server? Via SSMS or through an application? If through an app, what is your connection string?

|||

On the second part of your explanation, it seems like you are trying to use Windows credentials (domain\login;passwordWink as part of the connection string. If my assumption is correct, then it would explain the “not associated with a trusted connection” error.

Windows authentication uses the Windows credentials used to establish the connection, if you need to switch to a different set of credentials (i.e. run as a different user), you will need to impersonate the Windows user first (i.e. using runas).

For the invalid ID issue, I am also surprised that the suggestion by z-on didn’t work. We will need more information in order to help.

· What is the error message that you are getting back

· Does it fail when connecting using sqlcmd as well?

· Does it fail on connections made on the same machine?

· Assuming the user Is the a Windows principal (please correct me if I am wrong)

· Is it a domain or a local machine Windows user

o If it I s a domain user, does the new system has access to the domain

o Does the service account used for SQL Server has proper permissions on the domain

· Does it have access to the system via Windows role membership (i.e. member of sysadmin group) or directly.

Thanks,

-Raul Garcia

SDE/T

SQL Server Engine

Wednesday, March 7, 2012

New Install, But I Need to Move Data Files

I could really use some help on this one. I know virtually nothing about SQL Server. We installed this because our database for the application we're running (Lexis Nexis Time Matters) had gotten too large for the Express 2005 version. We've also installed a new version of the software, and on a new server.

The new server has the drive partitioned into two partitions. When installing the application, I selected drive D (545 gb) as the data drive, but when I installed SQL server, it was installed on drive C (12 gb). I did not realize that the the application data was simply configuration information, and the data for the program is actually being installed on the C drive (\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data).

Is there a simple procedure to move this data, including the SQL instance (TIMEMATTERS) to the D drive? Or should I uninstall and start over?

If possible it would be better to uninstall SQL Server and reinstall it.

When installing SQL Server when you get to the page which asks you what services you want to install (the screen has 5 or 6 check boxes on it) you have to click on the Advanced Button to change the drive that SQL Server installs to.

If you can't uninstall the SQL Server you can detach the database (right click on the database and select "Tasks", then "Detach").

Then go move the physical MDF and LDF files for the database to the D drive (I recommend to a folder name D:\MSSQL\MSSQL.1\MSSQL\Data\).

Then in the SQL Management Studio right click on Databases, and select "Attach". Browse to the folder that you moved the MDF and LDF to and select the MDF file. Validate that the LDF is shown with the correct path (you may need to change it) then click OK (or what ever the correct name for the button is).

This will reattach the database so that users can access it and your application will begin working again.

Please keep in mind that your users will NOT be able to access the application while you are doing this, so it should be done after hours to minimize the impact.

Monday, February 20, 2012

new database, set userid and password

I am creating a new application and just created a new database

Application: VB.net 2005/ ASP.net

Database: Sql Server 2005 with four tables

I need to set the userid and password on the database. How do I do that?

I want to be able to create a SQL connection object in my code and I have something like the following:

<CODE>

Dim objconAsNew SqlConnection("server=serverName;uid=;pwd=;database=SomeDatabase")

</CODE>

but the "uid" and the "pwd" are not set on my database. what is an easy way to do this? thanks

This site has complete connection strings in all pop db systems:http://www.connectionstrings.com/

Both Windows Auth and SqlServer Auth has examples in the site.

|||

I recommend that you use windows integrated authentication

Simply make sure that the user identify of the application pool in which your application lives has login rights to your database. Then you don't have to store the password in your config file or your code.

Check this outhttp://weblogs.asp.net/achang/archive/2004/04/15/113866.aspx

Matt

|||

Hi

Yes Matt you are right.

By windows authentication we can achieve this.

First use windows authentication, create user, give him neccessary rights, and mapped this user with your newly created database.

and now in your webconfig provide this username and password to connect this database.

I hope this will helpful u...

|||

Preferably you do not put the username and password in the web.config

If we are using windows integrated authentication, then you want to give permission to the windows account that your application runs under on the database. Then you do not have to worry about password in the config file.

New database file locations

Hi. Could anyone suggest why, whenever a third-party application that creates
and uses its own SQL Server database, it creates the physical files in a
location that is not the default? This doesn't seem to be an app-specific
issue as different apps have done the same thing.
As per the general advise data and log files on my system are held on
separate volumes and when I create a new database myself the physical files
are created in their default locations. However this is not the case with
third-party apps. They seem to be creating the files in the same volume. How
do I change this behavior. I had thought that the settings of the model
database would determine where those files would go?
YaHozna.Hello,
I feel that your third party application creates the database specifying the
path. In this case the database will be created based on the path specified
in CREATE DATABASE command. Incase if the path is not configurab,e in
application installlation, you could detach the database, copy the files
to required drive and folder and attach the database. See SP_DETACH_DB and
SP_ATTACH_DB in books online..
Thanks
Hari
"YaHozna" <YaHozna@.discussions.microsoft.com> wrote in message
news:A74E91B5-7CDC-4143-ADFE-EF814499DE0B@.microsoft.com...
> Hi. Could anyone suggest why, whenever a third-party application that
> creates
> and uses its own SQL Server database, it creates the physical files in a
> location that is not the default? This doesn't seem to be an app-specific
> issue as different apps have done the same thing.
> As per the general advise data and log files on my system are held on
> separate volumes and when I create a new database myself the physical
> files
> are created in their default locations. However this is not the case with
> third-party apps. They seem to be creating the files in the same volume.
> How
> do I change this behavior. I had thought that the settings of the model
> database would determine where those files would go?
> YaHozna.|||There is a server setting that determines the default location for the data
and log files, not hte master db. Check the properties of the server in
Enterprise Manager and you will find them.
--
Andrew J. Kelly SQL MVP
"YaHozna" <YaHozna@.discussions.microsoft.com> wrote in message
news:A74E91B5-7CDC-4143-ADFE-EF814499DE0B@.microsoft.com...
> Hi. Could anyone suggest why, whenever a third-party application that
> creates
> and uses its own SQL Server database, it creates the physical files in a
> location that is not the default? This doesn't seem to be an app-specific
> issue as different apps have done the same thing.
> As per the general advise data and log files on my system are held on
> separate volumes and when I create a new database myself the physical
> files
> are created in their default locations. However this is not the case with
> third-party apps. They seem to be creating the files in the same volume.
> How
> do I change this behavior. I had thought that the settings of the model
> database would determine where those files would go?
> YaHozna.|||Many 3rd party applications do this, unfortunately.
When CREATE DATABASE is used without options, the defaults are
taken from the model database, but it is perfectly possible to
override the defaults by using the NAME and FILENAME options with
the CREATE DATABASE statement.
You can change the location of the files after the installation.
From http://sql.veranoest.net/sql_faq.htm
Q. How can I move my database files to another disk in my SQL
Server?
A. An easy way to move user database files to a different location
is by detaching, moving and attaching the user database.
This can be done in SQL Server Management Studio so you don't have
to type any code.
Here are the steps:
1. Start SQL Server Management Studio
2. Expand the server instance, expand Databases
3. right-click the database you want to move, and choose
"Properties"
4. In the Properties window, choose "Files" and write down the
current file paths. Click "Cancel"
5. right-click the database again, and choose "Tasks - Detach..."
6. click "OK" in the next window
7. Use Windows Explorer to move the data and log files (.mdf and
.ldf) to the new location
8. right-click Databases, and choose "Attach..."
9. In the "Attach databases" window, click "Add"
10.In the "Locate database files" window, browse to the new
location and select the .mdf file. Click "OK"
11.In the details pane, verify that the new location is listed for
both the .mdf and the .ldf file. Click "OK"
12.In SQL Server Management Studio, choose "View - Refresh" and
verify that your database is listed again under Databases
Alternatively you can backup the database and restore it,
specifying a different location for the files on the options table
or use the MOVE clause in the RESTORE command in Transact-SQL.
Details are here:
221465 - INF: Using the WITH MOVE Option with the RESTORE Statement
http://support.microsoft.com/?kbid=221465
If you want to move the system databases, be sure to read these
articles:
Moving the SQL 2005 System Databases
http://www.sqlservercentral.com/columnists/vIacoboni/2605.asp
224071 - How to move SQL Server databases to a new location by
using Detach and Attach functions in SQL Server
http://support.microsoft.com/?kbid=224071
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
SQL troubleshooting: http://sql.veranoest.net
___ please respond in newsgroup, NOT by private email ___
=?Utf-8?B?WWFIb3puYQ==?= <YaHozna@.discussions.microsoft.com> wrote
on 11 feb 2007 in microsoft.public.sqlserver.server:
> Hi. Could anyone suggest why, whenever a third-party application
> that creates and uses its own SQL Server database, it creates
> the physical files in a location that is not the default? This
> doesn't seem to be an app-specific issue as different apps have
> done the same thing.
> As per the general advise data and log files on my system are
> held on separate volumes and when I create a new database myself
> the physical files are created in their default locations.
> However this is not the case with third-party apps. They seem to
> be creating the files in the same volume. How do I change this
> behavior. I had thought that the settings of the model database
> would determine where those files would go?
> YaHozna.|||> When CREATE DATABASE is used without options, the defaults are
> taken from the model database, but it is perfectly possible to
> override the defaults by using the NAME and FILENAME options with
> the CREATE DATABASE statement.
Although the model database is used as a template for new databases, the
default file locations are not determined by the model database. As Andrew
mentioned, default file locations can be specified separately via server
properties.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Vera Noest" <vera.noest@.remove-this.hem.utfors.se> wrote in message
news:Xns98D4A3986E7CDveranoesthemutforsse@.207.46.248.16...
> Many 3rd party applications do this, unfortunately.
> When CREATE DATABASE is used without options, the defaults are
> taken from the model database, but it is perfectly possible to
> override the defaults by using the NAME and FILENAME options with
> the CREATE DATABASE statement.
> You can change the location of the files after the installation.
> From http://sql.veranoest.net/sql_faq.htm
> Q. How can I move my database files to another disk in my SQL
> Server?
> A. An easy way to move user database files to a different location
> is by detaching, moving and attaching the user database.
> This can be done in SQL Server Management Studio so you don't have
> to type any code.
> Here are the steps:
> 1. Start SQL Server Management Studio
> 2. Expand the server instance, expand Databases
> 3. right-click the database you want to move, and choose
> "Properties"
> 4. In the Properties window, choose "Files" and write down the
> current file paths. Click "Cancel"
> 5. right-click the database again, and choose "Tasks - Detach..."
> 6. click "OK" in the next window
> 7. Use Windows Explorer to move the data and log files (.mdf and
> .ldf) to the new location
> 8. right-click Databases, and choose "Attach..."
> 9. In the "Attach databases" window, click "Add"
> 10.In the "Locate database files" window, browse to the new
> location and select the .mdf file. Click "OK"
> 11.In the details pane, verify that the new location is listed for
> both the .mdf and the .ldf file. Click "OK"
> 12.In SQL Server Management Studio, choose "View - Refresh" and
> verify that your database is listed again under Databases
> Alternatively you can backup the database and restore it,
> specifying a different location for the files on the options table
> or use the MOVE clause in the RESTORE command in Transact-SQL.
> Details are here:
> 221465 - INF: Using the WITH MOVE Option with the RESTORE Statement
> http://support.microsoft.com/?kbid=221465
> If you want to move the system databases, be sure to read these
> articles:
> Moving the SQL 2005 System Databases
> http://www.sqlservercentral.com/columnists/vIacoboni/2605.asp
> 224071 - How to move SQL Server databases to a new location by
> using Detach and Attach functions in SQL Server
> http://support.microsoft.com/?kbid=224071
> _________________________________________________________
> Vera Noest
> MCSE, CCEA, Microsoft MVP - Terminal Server
> SQL troubleshooting: http://sql.veranoest.net
> ___ please respond in newsgroup, NOT by private email ___
> =?Utf-8?B?WWFIb3puYQ==?= <YaHozna@.discussions.microsoft.com> wrote
> on 11 feb 2007 in microsoft.public.sqlserver.server:
>> Hi. Could anyone suggest why, whenever a third-party application
>> that creates and uses its own SQL Server database, it creates
>> the physical files in a location that is not the default? This
>> doesn't seem to be an app-specific issue as different apps have
>> done the same thing.
>> As per the general advise data and log files on my system are
>> held on separate volumes and when I create a new database myself
>> the physical files are created in their default locations.
>> However this is not the case with third-party apps. They seem to
>> be creating the files in the same volume. How do I change this
>> behavior. I had thought that the settings of the model database
>> would determine where those files would go?
>> YaHozna.|||Applications should never care where the database files are placed. That's a
DBA's job. Ideally, applications shouldn't be creating databases (I know they
do). They should use databases created for them. In cases they do create
databases in wrong locations, you should plan to move the files to the
correct locations.
But then I've seen apps that create databases on the fly as part of the
normal production process. Ouch!
Linchi
"YaHozna" wrote:
> Hi. Could anyone suggest why, whenever a third-party application that creates
> and uses its own SQL Server database, it creates the physical files in a
> location that is not the default? This doesn't seem to be an app-specific
> issue as different apps have done the same thing.
> As per the general advise data and log files on my system are held on
> separate volumes and when I create a new database myself the physical files
> are created in their default locations. However this is not the case with
> third-party apps. They seem to be creating the files in the same volume. How
> do I change this behavior. I had thought that the settings of the model
> database would determine where those files would go?
> YaHozna.|||Thanks Andrew and to the others who contributed. I did double-check the
Server settings and these are as they should be: data files are created on
volume E of a RAID array and Log files on volume D. Tempdb is also on volume
E and it was in that location - the folder in which the tempdb files exist -
that all files for new databases created by third-party apps seemed to be
being created for some reason.
No problem moving the files. Just wondered why this was happening.
Regards,
YaHozna
"Andrew J. Kelly" wrote:
> There is a server setting that determines the default location for the data
> and log files, not hte master db. Check the properties of the server in
> Enterprise Manager and you will find them.
> --
> Andrew J. Kelly SQL MVP
> "YaHozna" <YaHozna@.discussions.microsoft.com> wrote in message
> news:A74E91B5-7CDC-4143-ADFE-EF814499DE0B@.microsoft.com...
> > Hi. Could anyone suggest why, whenever a third-party application that
> > creates
> > and uses its own SQL Server database, it creates the physical files in a
> > location that is not the default? This doesn't seem to be an app-specific
> > issue as different apps have done the same thing.
> >
> > As per the general advise data and log files on my system are held on
> > separate volumes and when I create a new database myself the physical
> > files
> > are created in their default locations. However this is not the case with
> > third-party apps. They seem to be creating the files in the same volume.
> > How
> > do I change this behavior. I had thought that the settings of the model
> > database would determine where those files would go?
> >
> > YaHozna.
>
>

New database file locations

Hi. Could anyone suggest why, whenever a third-party application that creates
and uses its own SQL Server database, it creates the physical files in a
location that is not the default? This doesn't seem to be an app-specific
issue as different apps have done the same thing.
As per the general advise data and log files on my system are held on
separate volumes and when I create a new database myself the physical files
are created in their default locations. However this is not the case with
third-party apps. They seem to be creating the files in the same volume. How
do I change this behavior. I had thought that the settings of the model
database would determine where those files would go?
YaHozna.
Hello,
I feel that your third party application creates the database specifying the
path. In this case the database will be created based on the path specified
in CREATE DATABASE command. Incase if the path is not configurab,e in
application installlation, you could detach the database, copy the files
to required drive and folder and attach the database. See SP_DETACH_DB and
SP_ATTACH_DB in books online..
Thanks
Hari
"YaHozna" <YaHozna@.discussions.microsoft.com> wrote in message
news:A74E91B5-7CDC-4143-ADFE-EF814499DE0B@.microsoft.com...
> Hi. Could anyone suggest why, whenever a third-party application that
> creates
> and uses its own SQL Server database, it creates the physical files in a
> location that is not the default? This doesn't seem to be an app-specific
> issue as different apps have done the same thing.
> As per the general advise data and log files on my system are held on
> separate volumes and when I create a new database myself the physical
> files
> are created in their default locations. However this is not the case with
> third-party apps. They seem to be creating the files in the same volume.
> How
> do I change this behavior. I had thought that the settings of the model
> database would determine where those files would go?
> YaHozna.
|||There is a server setting that determines the default location for the data
and log files, not hte master db. Check the properties of the server in
Enterprise Manager and you will find them.
Andrew J. Kelly SQL MVP
"YaHozna" <YaHozna@.discussions.microsoft.com> wrote in message
news:A74E91B5-7CDC-4143-ADFE-EF814499DE0B@.microsoft.com...
> Hi. Could anyone suggest why, whenever a third-party application that
> creates
> and uses its own SQL Server database, it creates the physical files in a
> location that is not the default? This doesn't seem to be an app-specific
> issue as different apps have done the same thing.
> As per the general advise data and log files on my system are held on
> separate volumes and when I create a new database myself the physical
> files
> are created in their default locations. However this is not the case with
> third-party apps. They seem to be creating the files in the same volume.
> How
> do I change this behavior. I had thought that the settings of the model
> database would determine where those files would go?
> YaHozna.
|||Many 3rd party applications do this, unfortunately.
When CREATE DATABASE is used without options, the defaults are
taken from the model database, but it is perfectly possible to
override the defaults by using the NAME and FILENAME options with
the CREATE DATABASE statement.
You can change the location of the files after the installation.
From http://sql.veranoest.net/sql_faq.htm
Q. How can I move my database files to another disk in my SQL
Server?
A. An easy way to move user database files to a different location
is by detaching, moving and attaching the user database.
This can be done in SQL Server Management Studio so you don't have
to type any code.
Here are the steps:
1. Start SQL Server Management Studio
2. Expand the server instance, expand Databases
3. right-click the database you want to move, and choose
"Properties"
4. In the Properties window, choose "Files" and write down the
current file paths. Click "Cancel"
5. right-click the database again, and choose "Tasks - Detach..."
6. click "OK" in the next window
7. Use Windows Explorer to move the data and log files (.mdf and
.ldf) to the new location
8. right-click Databases, and choose "Attach..."
9. In the "Attach databases" window, click "Add"
10.In the "Locate database files" window, browse to the new
location and select the .mdf file. Click "OK"
11.In the details pane, verify that the new location is listed for
both the .mdf and the .ldf file. Click "OK"
12.In SQL Server Management Studio, choose "View - Refresh" and
verify that your database is listed again under Databases
Alternatively you can backup the database and restore it,
specifying a different location for the files on the options table
or use the MOVE clause in the RESTORE command in Transact-SQL.
Details are here:
221465 - INF: Using the WITH MOVE Option with the RESTORE Statement
http://support.microsoft.com/?kbid=221465
If you want to move the system databases, be sure to read these
articles:
Moving the SQL 2005 System Databases
http://www.sqlservercentral.com/columnists/vIacoboni/2605.asp
224071 - How to move SQL Server databases to a new location by
using Detach and Attach functions in SQL Server
http://support.microsoft.com/?kbid=224071
__________________________________________________ _______
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
SQL troubleshooting: http://sql.veranoest.net
___ please respond in newsgroup, NOT by private email ___
=?Utf-8?B?WWFIb3puYQ==?= <YaHozna@.discussions.microsoft.com> wrote
on 11 feb 2007 in microsoft.public.sqlserver.server:

> Hi. Could anyone suggest why, whenever a third-party application
> that creates and uses its own SQL Server database, it creates
> the physical files in a location that is not the default? This
> doesn't seem to be an app-specific issue as different apps have
> done the same thing.
> As per the general advise data and log files on my system are
> held on separate volumes and when I create a new database myself
> the physical files are created in their default locations.
> However this is not the case with third-party apps. They seem to
> be creating the files in the same volume. How do I change this
> behavior. I had thought that the settings of the model database
> would determine where those files would go?
> YaHozna.
|||> When CREATE DATABASE is used without options, the defaults are
> taken from the model database, but it is perfectly possible to
> override the defaults by using the NAME and FILENAME options with
> the CREATE DATABASE statement.
Although the model database is used as a template for new databases, the
default file locations are not determined by the model database. As Andrew
mentioned, default file locations can be specified separately via server
properties.
Hope this helps.
Dan Guzman
SQL Server MVP
"Vera Noest" <vera.noest@.remove-this.hem.utfors.se> wrote in message
news:Xns98D4A3986E7CDveranoesthemutforsse@.207.46.2 48.16...[vbcol=seagreen]
> Many 3rd party applications do this, unfortunately.
> When CREATE DATABASE is used without options, the defaults are
> taken from the model database, but it is perfectly possible to
> override the defaults by using the NAME and FILENAME options with
> the CREATE DATABASE statement.
> You can change the location of the files after the installation.
> From http://sql.veranoest.net/sql_faq.htm
> Q. How can I move my database files to another disk in my SQL
> Server?
> A. An easy way to move user database files to a different location
> is by detaching, moving and attaching the user database.
> This can be done in SQL Server Management Studio so you don't have
> to type any code.
> Here are the steps:
> 1. Start SQL Server Management Studio
> 2. Expand the server instance, expand Databases
> 3. right-click the database you want to move, and choose
> "Properties"
> 4. In the Properties window, choose "Files" and write down the
> current file paths. Click "Cancel"
> 5. right-click the database again, and choose "Tasks - Detach..."
> 6. click "OK" in the next window
> 7. Use Windows Explorer to move the data and log files (.mdf and
> .ldf) to the new location
> 8. right-click Databases, and choose "Attach..."
> 9. In the "Attach databases" window, click "Add"
> 10.In the "Locate database files" window, browse to the new
> location and select the .mdf file. Click "OK"
> 11.In the details pane, verify that the new location is listed for
> both the .mdf and the .ldf file. Click "OK"
> 12.In SQL Server Management Studio, choose "View - Refresh" and
> verify that your database is listed again under Databases
> Alternatively you can backup the database and restore it,
> specifying a different location for the files on the options table
> or use the MOVE clause in the RESTORE command in Transact-SQL.
> Details are here:
> 221465 - INF: Using the WITH MOVE Option with the RESTORE Statement
> http://support.microsoft.com/?kbid=221465
> If you want to move the system databases, be sure to read these
> articles:
> Moving the SQL 2005 System Databases
> http://www.sqlservercentral.com/columnists/vIacoboni/2605.asp
> 224071 - How to move SQL Server databases to a new location by
> using Detach and Attach functions in SQL Server
> http://support.microsoft.com/?kbid=224071
> __________________________________________________ _______
> Vera Noest
> MCSE, CCEA, Microsoft MVP - Terminal Server
> SQL troubleshooting: http://sql.veranoest.net
> ___ please respond in newsgroup, NOT by private email ___
> =?Utf-8?B?WWFIb3puYQ==?= <YaHozna@.discussions.microsoft.com> wrote
> on 11 feb 2007 in microsoft.public.sqlserver.server:
|||Applications should never care where the database files are placed. That's a
DBA's job. Ideally, applications shouldn't be creating databases (I know they
do). They should use databases created for them. In cases they do create
databases in wrong locations, you should plan to move the files to the
correct locations.
But then I've seen apps that create databases on the fly as part of the
normal production process. Ouch!
Linchi
"YaHozna" wrote:

> Hi. Could anyone suggest why, whenever a third-party application that creates
> and uses its own SQL Server database, it creates the physical files in a
> location that is not the default? This doesn't seem to be an app-specific
> issue as different apps have done the same thing.
> As per the general advise data and log files on my system are held on
> separate volumes and when I create a new database myself the physical files
> are created in their default locations. However this is not the case with
> third-party apps. They seem to be creating the files in the same volume. How
> do I change this behavior. I had thought that the settings of the model
> database would determine where those files would go?
> YaHozna.
|||Thanks Andrew and to the others who contributed. I did double-check the
Server settings and these are as they should be: data files are created on
volume E of a RAID array and Log files on volume D. Tempdb is also on volume
E and it was in that location - the folder in which the tempdb files exist -
that all files for new databases created by third-party apps seemed to be
being created for some reason.
No problem moving the files. Just wondered why this was happening.
Regards,
YaHozna
"Andrew J. Kelly" wrote:

> There is a server setting that determines the default location for the data
> and log files, not hte master db. Check the properties of the server in
> Enterprise Manager and you will find them.
> --
> Andrew J. Kelly SQL MVP
> "YaHozna" <YaHozna@.discussions.microsoft.com> wrote in message
> news:A74E91B5-7CDC-4143-ADFE-EF814499DE0B@.microsoft.com...
>
>

New database file locations

Hi. Could anyone suggest why, whenever a third-party application that create
s
and uses its own SQL Server database, it creates the physical files in a
location that is not the default? This doesn't seem to be an app-specific
issue as different apps have done the same thing.
As per the general advise data and log files on my system are held on
separate volumes and when I create a new database myself the physical files
are created in their default locations. However this is not the case with
third-party apps. They seem to be creating the files in the same volume. How
do I change this behavior. I had thought that the settings of the model
database would determine where those files would go?
YaHozna.Hello,
I feel that your third party application creates the database specifying the
path. In this case the database will be created based on the path specified
in CREATE DATABASE command. Incase if the path is not configurab,e in
application installlation, you could detach the database, copy the files
to required drive and folder and attach the database. See SP_DETACH_DB and
SP_ATTACH_DB in books online..
Thanks
Hari
"YaHozna" <YaHozna@.discussions.microsoft.com> wrote in message
news:A74E91B5-7CDC-4143-ADFE-EF814499DE0B@.microsoft.com...
> Hi. Could anyone suggest why, whenever a third-party application that
> creates
> and uses its own SQL Server database, it creates the physical files in a
> location that is not the default? This doesn't seem to be an app-specific
> issue as different apps have done the same thing.
> As per the general advise data and log files on my system are held on
> separate volumes and when I create a new database myself the physical
> files
> are created in their default locations. However this is not the case with
> third-party apps. They seem to be creating the files in the same volume.
> How
> do I change this behavior. I had thought that the settings of the model
> database would determine where those files would go?
> YaHozna.|||There is a server setting that determines the default location for the data
and log files, not hte master db. Check the properties of the server in
Enterprise Manager and you will find them.
Andrew J. Kelly SQL MVP
"YaHozna" <YaHozna@.discussions.microsoft.com> wrote in message
news:A74E91B5-7CDC-4143-ADFE-EF814499DE0B@.microsoft.com...
> Hi. Could anyone suggest why, whenever a third-party application that
> creates
> and uses its own SQL Server database, it creates the physical files in a
> location that is not the default? This doesn't seem to be an app-specific
> issue as different apps have done the same thing.
> As per the general advise data and log files on my system are held on
> separate volumes and when I create a new database myself the physical
> files
> are created in their default locations. However this is not the case with
> third-party apps. They seem to be creating the files in the same volume.
> How
> do I change this behavior. I had thought that the settings of the model
> database would determine where those files would go?
> YaHozna.|||Many 3rd party applications do this, unfortunately.
When CREATE DATABASE is used without options, the defaults are
taken from the model database, but it is perfectly possible to
override the defaults by using the NAME and FILENAME options with
the CREATE DATABASE statement.
You can change the location of the files after the installation.
From http://sql.veranoest.net/sql_faq.htm
Q. How can I move my database files to another disk in my SQL
Server?
A. An easy way to move user database files to a different location
is by detaching, moving and attaching the user database.
This can be done in SQL Server Management Studio so you don't have
to type any code.
Here are the steps:
1. Start SQL Server Management Studio
2. Expand the server instance, expand Databases
3. right-click the database you want to move, and choose
"Properties"
4. In the Properties window, choose "Files" and write down the
current file paths. Click "Cancel"
5. right-click the database again, and choose "Tasks - Detach..."
6. click "OK" in the next window
7. Use Windows Explorer to move the data and log files (.mdf and
.ldf) to the new location
8. right-click Databases, and choose "Attach..."
9. In the "Attach databases" window, click "Add"
10.In the "Locate database files" window, browse to the new
location and select the .mdf file. Click "OK"
11.In the details pane, verify that the new location is listed for
both the .mdf and the .ldf file. Click "OK"
12.In SQL Server Management Studio, choose "View - Refresh" and
verify that your database is listed again under Databases
Alternatively you can backup the database and restore it,
specifying a different location for the files on the options table
or use the MOVE clause in the RESTORE command in Transact-SQL.
Details are here:
221465 - INF: Using the WITH MOVE Option with the RESTORE Statement
http://support.microsoft.com/?kbid=221465
If you want to move the system databases, be sure to read these
articles:
Moving the SQL 2005 System Databases
http://www.sqlservercentral.com/col...coboni/2605.asp
224071 - How to move SQL Server databases to a new location by
using Detach and Attach functions in SQL Server
http://support.microsoft.com/?kbid=224071
________________________________________
_________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
SQL troubleshooting: http://sql.veranoest.net
___ please respond in newsgroup, NOT by private email ___
examnotes <YaHozna@.discussions.microsoft.com> wrote
on 11 feb 2007 in microsoft.public.sqlserver.server:

> Hi. Could anyone suggest why, whenever a third-party application
> that creates and uses its own SQL Server database, it creates
> the physical files in a location that is not the default? This
> doesn't seem to be an app-specific issue as different apps have
> done the same thing.
> As per the general advise data and log files on my system are
> held on separate volumes and when I create a new database myself
> the physical files are created in their default locations.
> However this is not the case with third-party apps. They seem to
> be creating the files in the same volume. How do I change this
> behavior. I had thought that the settings of the model database
> would determine where those files would go?
> YaHozna.|||> When CREATE DATABASE is used without options, the defaults are
> taken from the model database, but it is perfectly possible to
> override the defaults by using the NAME and FILENAME options with
> the CREATE DATABASE statement.
Although the model database is used as a template for new databases, the
default file locations are not determined by the model database. As Andrew
mentioned, default file locations can be specified separately via server
properties.
Hope this helps.
Dan Guzman
SQL Server MVP
"Vera Noest" <vera.noest@.remove-this.hem.utfors.se> wrote in message
news:Xns98D4A3986E7CDveranoesthemutforss
e@.207.46.248.16...[vbcol=seagreen]
> Many 3rd party applications do this, unfortunately.
> When CREATE DATABASE is used without options, the defaults are
> taken from the model database, but it is perfectly possible to
> override the defaults by using the NAME and FILENAME options with
> the CREATE DATABASE statement.
> You can change the location of the files after the installation.
> From http://sql.veranoest.net/sql_faq.htm
> Q. How can I move my database files to another disk in my SQL
> Server?
> A. An easy way to move user database files to a different location
> is by detaching, moving and attaching the user database.
> This can be done in SQL Server Management Studio so you don't have
> to type any code.
> Here are the steps:
> 1. Start SQL Server Management Studio
> 2. Expand the server instance, expand Databases
> 3. right-click the database you want to move, and choose
> "Properties"
> 4. In the Properties window, choose "Files" and write down the
> current file paths. Click "Cancel"
> 5. right-click the database again, and choose "Tasks - Detach..."
> 6. click "OK" in the next window
> 7. Use Windows Explorer to move the data and log files (.mdf and
> .ldf) to the new location
> 8. right-click Databases, and choose "Attach..."
> 9. In the "Attach databases" window, click "Add"
> 10.In the "Locate database files" window, browse to the new
> location and select the .mdf file. Click "OK"
> 11.In the details pane, verify that the new location is listed for
> both the .mdf and the .ldf file. Click "OK"
> 12.In SQL Server Management Studio, choose "View - Refresh" and
> verify that your database is listed again under Databases
> Alternatively you can backup the database and restore it,
> specifying a different location for the files on the options table
> or use the MOVE clause in the RESTORE command in Transact-SQL.
> Details are here:
> 221465 - INF: Using the WITH MOVE Option with the RESTORE Statement
> http://support.microsoft.com/?kbid=221465
> If you want to move the system databases, be sure to read these
> articles:
> Moving the SQL 2005 System Databases
> http://www.sqlservercentral.com/col...coboni/2605.asp
> 224071 - How to move SQL Server databases to a new location by
> using Detach and Attach functions in SQL Server
> http://support.microsoft.com/?kbid=224071
> ________________________________________
_________________
> Vera Noest
> MCSE, CCEA, Microsoft MVP - Terminal Server
> SQL troubleshooting: http://sql.veranoest.net
> ___ please respond in newsgroup, NOT by private email ___
> examnotes <YaHozna@.discussions.microsoft.com> wrote
> on 11 feb 2007 in microsoft.public.sqlserver.server:
>|||Applications should never care where the database files are placed. That's a
DBA's job. Ideally, applications shouldn't be creating databases (I know the
y
do). They should use databases created for them. In cases they do create
databases in wrong locations, you should plan to move the files to the
correct locations.
But then I've seen apps that create databases on the fly as part of the
normal production process. Ouch!
Linchi
"YaHozna" wrote:

> Hi. Could anyone suggest why, whenever a third-party application that crea
tes
> and uses its own SQL Server database, it creates the physical files in a
> location that is not the default? This doesn't seem to be an app-specific
> issue as different apps have done the same thing.
> As per the general advise data and log files on my system are held on
> separate volumes and when I create a new database myself the physical file
s
> are created in their default locations. However this is not the case with
> third-party apps. They seem to be creating the files in the same volume. H
ow
> do I change this behavior. I had thought that the settings of the model
> database would determine where those files would go?
> YaHozna.|||Thanks Andrew and to the others who contributed. I did double-check the
Server settings and these are as they should be: data files are created on
volume E of a RAID array and Log files on volume D. Tempdb is also on volume
E and it was in that location - the folder in which the tempdb files exist -
that all files for new databases created by third-party apps seemed to be
being created for some reason.
No problem moving the files. Just wondered why this was happening.
Regards,
YaHozna
"Andrew J. Kelly" wrote:

> There is a server setting that determines the default location for the dat
a
> and log files, not hte master db. Check the properties of the server in
> Enterprise Manager and you will find them.
> --
> Andrew J. Kelly SQL MVP
> "YaHozna" <YaHozna@.discussions.microsoft.com> wrote in message
> news:A74E91B5-7CDC-4143-ADFE-EF814499DE0B@.microsoft.com...
>
>

New Crystal Reporter

Hi everyone. I've been developing an application which needs to create a couple of reports. I was going to use microsoft Graph for the Charts but it turns out that that's not recommendable.

So I decided to get into Crystal Reports. The point is that the help I've found is somewhat generic and I need something a little more specific.

What I need to do is to show a chart with the completed and not completed sales in a specific month. And show another form with the percentages of this sales.

I'm using VB6 and an Access database for my project.

If anybody knows where can I find some help... please let me know

Thanx in advance :wave:Create a query in access that summarizes your sales data by month, giving a field for Year & Month, and fields for Complete and Incomplete.
Use the Report Expert to connect to the Access Database, once connected you should see your query exposed as a Stored Procedure.
Select the query, and select field you wish to show, and then group by month.

When done, you should be able to right-click on the Group Header and select ChangeGroup. If you have a properly formated date CR will auto-recognise and type the field as date, and you should see a dropdown combo with caption "The section will be printed".
Select "for each month" from the combo.

When designing the Chart, select Advanced in the Data tab, and in the "Place Chart" combo, you should be able to select the group name, if you want to print the chart for each month, or select once per report option. Later you will put the Chart in the Group Footer if you selected the option to print each change of date (which in this case means each month, cos that's the group selection formula you selected), or put it in the report footer if you selected the "Once per Report" option.
Then select the summary fields that your SQL statement created from the list named "Available Fields" and put them in the "ShowValue(s)" list.
Oh, and don't forget to select an option for the combo above the "Show Values" one.

That just about ought to get you close......

Dave|||Create a query in access that summarizes your sales data by month, giving a field for Year & Month, and fields for Complete and Incomplete.
Use the Report Expert to connect to the Access Database, once connected you should see your query exposed as a Stored Procedure.
Select the query, and select field you wish to show, and then group by month.

When done, you should be able to right-click on the Group Header and select ChangeGroup. If you have a properly formated date CR will auto-recognise and type the field as date, and you should see a dropdown combo with caption "The section will be printed".
Select "for each month" from the combo.

When designing the Chart, select Advanced in the Data tab, and in the "Place Chart" combo, you should be able to select the group name, if you want to print the chart for each month, or select once per report option. Later you will put the Chart in the Group Footer if you selected the option to print each change of date (which in this case means each month, cos that's the group selection formula you selected), or put it in the report footer if you selected the "Once per Report" option.
Then select the summary fields that your SQL statement created from the list named "Available Fields" and put them in the "ShowValue(s)" list.
Oh, and don't forget to select an option for the combo above the "Show Values" one.

That just about ought to get you close......

Dave

Thanx Dave... I know this maybe a little abusive but, do you have some code so I have another reference?

Anyway... thanx for your reply, I'll try to get it running :wave:|||Do you mean the SQL, or code for the report?
Need to work out what you do and don't know......
Only real code in this is SQL, aprt from a formula you'd need to sum the values of Completed and Not Completed, so something like:

SELECT Id, Date, Completed, Value from Sales WHERE (Sales.Date > DateAdd("d", -14, Date()) AND Sales.Date <= Date())

would give you last 14 days of data.
I'd make Completed field a boolean so you can use it in the report to apply logic to an aggregation.

I've attached a zip file with a small table layout in Excel format. You can import it into Access and then open the report.
You may have to reset the Location to ensure that the ODBC connection on your box works Ok - see Database menu, Set Location... option.

Don't forget, if you find what I've given you useful, remember to rate the post and finalise the thread.

Dave|||I mean the CR Code. That's what I'm new at. The query is not that big of a deal (kind of hehe) but the problem is that I don't know how to import those results to a .rpt

I am checkin the zip you attached and hope to find out a way to create my graph. I'll rate the thread anyway.

Thanx a lot springsoft