Showing posts with label following. Show all posts
Showing posts with label following. Show all posts

Wednesday, March 28, 2012

Moving a logic loop to SQL Server

I am using C# and ASP.NET 2.0, with SQL Server 2000. In my database I have a table that is similar to the following:

WebpageId WebpageAddress Handler
1 /company/about ~/about.aspx
2 /blog ~/blog.aspx

As you can guess, one of my queries will be a SELECT command where WebpageAddress = @.address.

The hiccup I have is with a friendly URL such as the following:

/blog/2005/10/6

The friendly URLs have no extension, so I cannot immediately "pick out" the extension. (If the address were /blog.aspx/2005/10/6, then things would be simpler.)

What I am doing at present is using a loop in C# where I first perform a query with that full address. If no match is found, I trim the address back to the last slash (/blog/2005/10) and perform another query. If no match is found, I trim the address (/blog/2005) and perform another query. Again, no match is found, so I trim the address again (/blog) and perform yet another query. This time, a match is found, in which case the URL rewriting looks vaguely like this:

~/blog.aspx?parameters=2005/10/6

While this works fine, these friendly URLs require hitting the database up to four or five times. My question is, can this looping logic be moved to SQL Server?

My SQL knowledge is extremely basic, so I am just looking for someone to point me in the right direction. If it is not possible, I'd love to know now rather than wasting hours trying. If it is possible, I've love to know the keyword or technique involved, so that I can Google for the full answer.

SELECT TOP 1 Handler
FROM MyTable
WHERE WebpageAddress=SUBSTRING(@.address,1,LEN(WebpageAddress))
ORDER BY LEN(WebpageAddress) DESC

I think will give you what you want. However, to answer your question, yes, you can loop as well, but it'd be slower.

Friday, March 23, 2012

Moving : AccessSQL Server 2005(Enterprise Edition) VB6—VB.Net

I am a new in .Net Environment. I am moving from VB to VB.Net and Access DB to SQL Server 2005. Please reply me the following questions bellow.

Access Works

SQL SERVER (SS)?

When I create .MSI file it include ADO library in that executable file and my client install software and don’t need any kind of file to install and wherever my program install it can be accessed by using following connection string.

Con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db\PAYROLL_DB.mdb;Persist Security Info=False" Con.Open

What file needed on client’s PC to access SS on server.

What about connection string change dynamically in client sides

I create relation on Access Relationship Diagram.

Where to create these diagrams either on VB.Net Server Explorer or on Management Studio? And how?

Please answers me this basic questions further I have more question in mind but please first answers me these questions…

Hi,

What file needed on client’s PC to access SS on server.

What about connection string change dynamically in client sides

-You will just need a driver to access SQL Server like the ADO (included in MDAC) or ADO.NET (included in the .NET FW) or the SQL Server Native Client (SNAC).

Where to create these diagrams either on VB.Net Server Explorer or on Management Studio? And how?


I would create them in the SSMS, don′t know if the functionality is EXACTLY the same as in server explorer, but I am used to to it there, but from a short inspection of mine I would say that they are feature-identical.

Jens K. Suessmeyer.

http://www.sqlserver2005.de

movie db query problems

Hi everyone!

this is the first time I use this forum although I already got plenty of help from it!

My problem is the following. I have created a movie database. I am using Oracle iSQL*Plus.

One table is called 'movie_t' another one 'person_t' and inside this last table is nexted a table called 'castmembers'.

one of my query is : "For all movies,list the leading actress, i.e. the first billed actress (in the order of credits). Show the movie Title, Genre, Director and Name of the actress ".

I found a complex solution that works:

SELECT title, name, creditorder "CREDIT ORDER"
FROM (select RANK() OVER (partition by m.title ORDER BY c.creditorder) rankcredit, m.title, p.name, c.creditorder
FROM person_t p, table(p.castmembers) c, movie_t m
WHERE c.movie_ref = ref(m) and p.gender = 'F') T WHERE RANKCREDIT = 1;

However, I am pretty sure that there must be a simple solution without using a method and partition.

I tried the following statement:

select m.title, m.director.name, m.genre, p.name, c.creditorder
from movie_t m, person_t p, table(p.castmembers)c
where ref(m) = c.movie_ref
and c.creditorder in
(Select min(d.creditorder)
from movie_t n, person_t q, table(q.castmembers)d
where m.title=n.title and m.director.name=n.director.name and

m.genre=n.genre and p.name=q.name and p.gender = 'F'
group by n.title, n.director.name, n.genre )

This unfortunately does not work, as it returns me all actresses!

please check my .doc file, it makes it easier to understand!

if anyone could help me a little bit, I would greatly appreciate, I have spent my whole sunday on that and it's getting realy frustrating for me!

thanks all,
Gaetansorry guys, my file did not atached, I try one more time :-)|||i finally found the solution :-)

SELECT c.movie_ref.title, p.name, c.creditorder, m.genre, m.director.name
FROM movie_t m, person_t p, table(p.castmembers)c
WHERE c.movie_ref= ref(m) and p.gender = 'F' and (c.creditorder) = all
( select min(c.creditorder) from person_t p, table(p.castmembers)c
WHERE c.movie_ref= ref(m) and p.gender = 'F');

if any of u think about anything else let me know, maybe I can also use the "having" function?

gaetan :-)sql

Wednesday, March 21, 2012

Move Temp DB and Logs to get more speed?

We are running a server with IIS and SQL 2K using the following
configuration:
C: OS/Inetpub
D: SQL 2K DB/Logs
E: IIS Logs
F: Not Used
G: Not Used
We have a single SQL 2K DB that all the websites use.
I'm currently constrained to a single server and the drive configuration. I
would like to optimize better by using the new F: and G: drives.
Additionally the C: and D: have no problem keeping up so I could move IIS
logs to the C: drive if needed.
Based on reading I've been doing it sounds like I will get the best
performance from moving the TempDB and the Logs files to different drives
but which configuration would be best:
F: TempDB DB and Logs
G: Our main DB Log Files
or
F: TempDB Logs
G: Our main DB Log Files
or
Something else.
Please suggest my best route.
Thanks!It's a best practice to have the data and logs on separate partitions. This
is both for safety (High Availability) as well as performance. Also, try to
keep tempdb separate from your app DB's. Thus, you could go with:
D: app data
F: app log
G: tempdb
Try that first. You can also move the tempdb log to F: and see if that
improves or degrades performance. Logs should not be placed on RAID5
partitions.
HTH
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau
"Bishop" <nospam@.nospam.com> wrote in message
news:u20v0S7gIHA.4692@.TK2MSFTNGP05.phx.gbl...
We are running a server with IIS and SQL 2K using the following
configuration:
C: OS/Inetpub
D: SQL 2K DB/Logs
E: IIS Logs
F: Not Used
G: Not Used
We have a single SQL 2K DB that all the websites use.
I'm currently constrained to a single server and the drive configuration. I
would like to optimize better by using the new F: and G: drives.
Additionally the C: and D: have no problem keeping up so I could move IIS
logs to the C: drive if needed.
Based on reading I've been doing it sounds like I will get the best
performance from moving the TempDB and the Logs files to different drives
but which configuration would be best:
F: TempDB DB and Logs
G: Our main DB Log Files
or
F: TempDB Logs
G: Our main DB Log Files
or
Something else.
Please suggest my best route.
Thanks!|||Hi Tom, thanks for the advice, just to clarify are you suggesting moving
both TempDB Data and Log to G to start or just the Data?
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:Ogjz5b7gIHA.5208@.TK2MSFTNGP04.phx.gbl...
> It's a best practice to have the data and logs on separate partitions.
> This
> is both for safety (High Availability) as well as performance. Also, try
> to
> keep tempdb separate from your app DB's. Thus, you could go with:
> D: app data
> F: app log
> G: tempdb
> Try that first. You can also move the tempdb log to F: and see if that
> improves or degrades performance. Logs should not be placed on RAID5
> partitions.
> HTH
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> SQL Server MVP
> Toronto, ON Canada
> https://mvp.support.microsoft.com/profile/Tom.Moreau
>
> "Bishop" <nospam@.nospam.com> wrote in message
> news:u20v0S7gIHA.4692@.TK2MSFTNGP05.phx.gbl...
> We are running a server with IIS and SQL 2K using the following
> configuration:
> C: OS/Inetpub
> D: SQL 2K DB/Logs
> E: IIS Logs
> F: Not Used
> G: Not Used
> We have a single SQL 2K DB that all the websites use.
> I'm currently constrained to a single server and the drive configuration.
> I
> would like to optimize better by using the new F: and G: drives.
> Additionally the C: and D: have no problem keeping up so I could move IIS
> logs to the C: drive if needed.
> Based on reading I've been doing it sounds like I will get the best
> performance from moving the TempDB and the Logs files to different drives
> but which configuration would be best:
> F: TempDB DB and Logs
> G: Our main DB Log Files
> or
> F: TempDB Logs
> G: Our main DB Log Files
> or
> Something else.
> Please suggest my best route.
> Thanks!
>
>|||Initially, try both data and log for tempdb. If that is satisfactory, you
can leave it. If you still have perf issues, then move the log to another
drive.
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau
"Bishop" <nospam@.nospam.com> wrote in message
news:OJ8syj7gIHA.5752@.TK2MSFTNGP03.phx.gbl...
Hi Tom, thanks for the advice, just to clarify are you suggesting moving
both TempDB Data and Log to G to start or just the Data?
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:Ogjz5b7gIHA.5208@.TK2MSFTNGP04.phx.gbl...
> It's a best practice to have the data and logs on separate partitions.
> This
> is both for safety (High Availability) as well as performance. Also, try
> to
> keep tempdb separate from your app DB's. Thus, you could go with:
> D: app data
> F: app log
> G: tempdb
> Try that first. You can also move the tempdb log to F: and see if that
> improves or degrades performance. Logs should not be placed on RAID5
> partitions.
> HTH
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> SQL Server MVP
> Toronto, ON Canada
> https://mvp.support.microsoft.com/profile/Tom.Moreau
>
> "Bishop" <nospam@.nospam.com> wrote in message
> news:u20v0S7gIHA.4692@.TK2MSFTNGP05.phx.gbl...
> We are running a server with IIS and SQL 2K using the following
> configuration:
> C: OS/Inetpub
> D: SQL 2K DB/Logs
> E: IIS Logs
> F: Not Used
> G: Not Used
> We have a single SQL 2K DB that all the websites use.
> I'm currently constrained to a single server and the drive configuration.
> I
> would like to optimize better by using the new F: and G: drives.
> Additionally the C: and D: have no problem keeping up so I could move IIS
> logs to the C: drive if needed.
> Based on reading I've been doing it sounds like I will get the best
> performance from moving the TempDB and the Logs files to different drives
> but which configuration would be best:
> F: TempDB DB and Logs
> G: Our main DB Log Files
> or
> F: TempDB Logs
> G: Our main DB Log Files
> or
> Something else.
> Please suggest my best route.
> Thanks!
>
>|||Changes worked great! Thanks for the recomendations.
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:%234W8TpKhIHA.6032@.TK2MSFTNGP03.phx.gbl...
> Initially, try both data and log for tempdb. If that is satisfactory, you
> can leave it. If you still have perf issues, then move the log to another
> drive.
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> SQL Server MVP
> Toronto, ON Canada
> https://mvp.support.microsoft.com/profile/Tom.Moreau
>
> "Bishop" <nospam@.nospam.com> wrote in message
> news:OJ8syj7gIHA.5752@.TK2MSFTNGP03.phx.gbl...
> Hi Tom, thanks for the advice, just to clarify are you suggesting moving
> both TempDB Data and Log to G to start or just the Data?
> "Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
> news:Ogjz5b7gIHA.5208@.TK2MSFTNGP04.phx.gbl...
>> It's a best practice to have the data and logs on separate partitions.
>> This
>> is both for safety (High Availability) as well as performance. Also, try
>> to
>> keep tempdb separate from your app DB's. Thus, you could go with:
>> D: app data
>> F: app log
>> G: tempdb
>> Try that first. You can also move the tempdb log to F: and see if that
>> improves or degrades performance. Logs should not be placed on RAID5
>> partitions.
>> HTH
>> --
>> Tom
>> ----
>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
>> SQL Server MVP
>> Toronto, ON Canada
>> https://mvp.support.microsoft.com/profile/Tom.Moreau
>>
>> "Bishop" <nospam@.nospam.com> wrote in message
>> news:u20v0S7gIHA.4692@.TK2MSFTNGP05.phx.gbl...
>> We are running a server with IIS and SQL 2K using the following
>> configuration:
>> C: OS/Inetpub
>> D: SQL 2K DB/Logs
>> E: IIS Logs
>> F: Not Used
>> G: Not Used
>> We have a single SQL 2K DB that all the websites use.
>> I'm currently constrained to a single server and the drive configuration.
>> I
>> would like to optimize better by using the new F: and G: drives.
>> Additionally the C: and D: have no problem keeping up so I could move IIS
>> logs to the C: drive if needed.
>> Based on reading I've been doing it sounds like I will get the best
>> performance from moving the TempDB and the Logs files to different drives
>> but which configuration would be best:
>> F: TempDB DB and Logs
>> G: Our main DB Log Files
>> or
>> F: TempDB Logs
>> G: Our main DB Log Files
>> or
>> Something else.
>> Please suggest my best route.
>> Thanks!
>>
>|||Great news. Thanx for the follow-up. :-)
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau
"Bishop" <nospam@.nospam.com> wrote in message
news:uDeCmGTiIHA.1164@.TK2MSFTNGP02.phx.gbl...
Changes worked great! Thanks for the recomendations.
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:%234W8TpKhIHA.6032@.TK2MSFTNGP03.phx.gbl...
> Initially, try both data and log for tempdb. If that is satisfactory, you
> can leave it. If you still have perf issues, then move the log to another
> drive.
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> SQL Server MVP
> Toronto, ON Canada
> https://mvp.support.microsoft.com/profile/Tom.Moreau
>
> "Bishop" <nospam@.nospam.com> wrote in message
> news:OJ8syj7gIHA.5752@.TK2MSFTNGP03.phx.gbl...
> Hi Tom, thanks for the advice, just to clarify are you suggesting moving
> both TempDB Data and Log to G to start or just the Data?
> "Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
> news:Ogjz5b7gIHA.5208@.TK2MSFTNGP04.phx.gbl...
>> It's a best practice to have the data and logs on separate partitions.
>> This
>> is both for safety (High Availability) as well as performance. Also, try
>> to
>> keep tempdb separate from your app DB's. Thus, you could go with:
>> D: app data
>> F: app log
>> G: tempdb
>> Try that first. You can also move the tempdb log to F: and see if that
>> improves or degrades performance. Logs should not be placed on RAID5
>> partitions.
>> HTH
>> --
>> Tom
>> ----
>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
>> SQL Server MVP
>> Toronto, ON Canada
>> https://mvp.support.microsoft.com/profile/Tom.Moreau
>>
>> "Bishop" <nospam@.nospam.com> wrote in message
>> news:u20v0S7gIHA.4692@.TK2MSFTNGP05.phx.gbl...
>> We are running a server with IIS and SQL 2K using the following
>> configuration:
>> C: OS/Inetpub
>> D: SQL 2K DB/Logs
>> E: IIS Logs
>> F: Not Used
>> G: Not Used
>> We have a single SQL 2K DB that all the websites use.
>> I'm currently constrained to a single server and the drive configuration.
>> I
>> would like to optimize better by using the new F: and G: drives.
>> Additionally the C: and D: have no problem keeping up so I could move IIS
>> logs to the C: drive if needed.
>> Based on reading I've been doing it sounds like I will get the best
>> performance from moving the TempDB and the Logs files to different drives
>> but which configuration would be best:
>> F: TempDB DB and Logs
>> G: Our main DB Log Files
>> or
>> F: TempDB Logs
>> G: Our main DB Log Files
>> or
>> Something else.
>> Please suggest my best route.
>> Thanks!
>>
>

Monday, March 19, 2012

Move SQL Server Management Studio Startup folder

Hello,
I recently moved the two following folders (SQL Server Management Studio,
Visual Studio 2005) to another directory but got the following error:
...Import and Export Settings tools Options page. The IDE will use your
most recent setting for this session
When I opened Enterprise Manager, it recreated the folders. I went to
Tools/Options, but couldn't find the option to change the start up location.
Any assistance with this would be appreciated.
--
Thanks in advance,
sck10Hi sck,
Thanks for using MSDN Managed Newsgroup Support.
By default, the SQL Management Studio is located at %Program Files
%\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe. If you
moved the SQL Management Studio, please go to the folder and find the
SqlWb.exe application. What's the result? Do you get any error message?
Please provide the entire error so that we may do the further troubleshoot.
Basically, we do not recommand move the SQL Management Studio folder and
the Visual Studio 2005 folder directly. This may cause some application
could not found the referenced files. The best way to move these folder is
re-install the Visual Studio and the SQL Management Studio.
Sincerely,
Wei Lu
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.|||Hi Wei Lu,
I am referencing the folders that SS2K5 makes in the "My Documents" and
where can I change the pointer to another directory.
C:\Documents and Settings\sck10\My Documents\SQL Server Management Studio
Backup
Code Snippets
Projects
Settings
Templates
Thanks,
sck10
"Wei Lu" <weilu@.online.microsoft.com> wrote in message
news:nSxQTvBaGHA.880@.TK2MSFTNGXA01.phx.gbl...
> Hi sck,
> Thanks for using MSDN Managed Newsgroup Support.
> By default, the SQL Management Studio is located at %Program Files
> %\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe. If you
> moved the SQL Management Studio, please go to the folder and find the
> SqlWb.exe application. What's the result? Do you get any error message?
> Please provide the entire error so that we may do the further
troubleshoot.
> Basically, we do not recommand move the SQL Management Studio folder and
> the Visual Studio 2005 folder directly. This may cause some application
> could not found the referenced files. The best way to move these folder is
> re-install the Visual Studio and the SQL Management Studio.
> Sincerely,
> Wei Lu
> 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.
>|||Hi sck10,
Thanks for the update.
My understanding of your issue is: You want to specify the location when
you create a project/ solution in SQL Management Studio. If I misunderstood
your concern, please feel free to let me know.
You could change the location where your Project store in the location
textbox. Also you can Browse to the location you want to store the project.
By default, SQL Management Studio will create the project in the My
Documents\SQL Server Management Studio\Projects folder.
Hope this will be helpful.
Sincerely,
Wei Lu
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.
--
>From: "sck10" <sck10@.online.nospam>
>References: <#fQKPj6ZGHA.4116@.TK2MSFTNGP05.phx.gbl>
<nSxQTvBaGHA.880@.TK2MSFTNGXA01.phx.gbl>
>Subject: Re: Move SQL Server Management Studio Startup folder
>Date: Wed, 26 Apr 2006 08:52:15 -0500
>Lines: 49
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1807
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807
>Message-ID: <eGEohiTaGHA.1240@.TK2MSFTNGP03.phx.gbl>
>Newsgroups: microsoft.public.sqlserver.server
>NNTP-Posting-Host: 11.202.185.135.in-addr.arpa 135.185.202.11
>Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP03.phx.gbl
>Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.sqlserver.server:429301
>X-Tomcat-NG: microsoft.public.sqlserver.server
>Hi Wei Lu,
>I am referencing the folders that SS2K5 makes in the "My Documents" and
>where can I change the pointer to another directory.
>C:\Documents and Settings\sck10\My Documents\SQL Server Management Studio
>Backup
>Code Snippets
>Projects
>Settings
>Templates
>Thanks,
>sck10
>"Wei Lu" <weilu@.online.microsoft.com> wrote in message
>news:nSxQTvBaGHA.880@.TK2MSFTNGXA01.phx.gbl...
>> Hi sck,
>> Thanks for using MSDN Managed Newsgroup Support.
>> By default, the SQL Management Studio is located at %Program Files
>> %\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe. If
you
>> moved the SQL Management Studio, please go to the folder and find the
>> SqlWb.exe application. What's the result? Do you get any error message?
>> Please provide the entire error so that we may do the further
>troubleshoot.
>> Basically, we do not recommand move the SQL Management Studio folder and
>> the Visual Studio 2005 folder directly. This may cause some application
>> could not found the referenced files. The best way to move these folder
is
>> re-install the Visual Studio and the SQL Management Studio.
>> Sincerely,
>> Wei Lu
>> 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.
>
>|||I have the same problem. Allow me to restate the issue from my point of
view, and maybe someone has an answer:
When I am in Management Studio and choose File... Open... File, the
standard Open File dialog box lists 3 icons in the left side: Desktop, My
Projects, and My Computer. The My Projects folder points to My Documents/SQL
Server Management Studio/My Projects.
I understand that this is the default location. I would like to CHANGE the
default location to a different folder.
There doesn't seem to be an option to set this default location in the
Management Studio Options. I tried to find the reference in the registry,
but cannot.
Alternatively, I would be happy to be able to ADD my preferred folder to
this dialog

Move SQL Server Management Studio Startup folder

Hello,
I recently moved the two following folders (SQL Server Management Studio,
Visual Studio 2005) to another directory but got the following error:
..Import and Export Settings tools Options page. The IDE will use your
most recent setting for this session
When I opened Enterprise Manager, it recreated the folders. I went to
Tools/Options, but couldn't find the option to change the start up location.
Any assistance with this would be appreciated.
--
Thanks in advance,
sck10Hi sck,
Thanks for using MSDN Managed Newsgroup Support.
By default, the SQL Management Studio is located at %Program Files
%\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE
\SqlWb.exe. If you
moved the SQL Management Studio, please go to the folder and find the
SqlWb.exe application. What's the result? Do you get any error message?
Please provide the entire error so that we may do the further troubleshoot.
Basically, we do not recommand move the SQL Management Studio folder and
the Visual Studio 2005 folder directly. This may cause some application
could not found the referenced files. The best way to move these folder is
re-install the Visual Studio and the SQL Management Studio.
Sincerely,
Wei Lu
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.|||Hi Wei Lu,
I am referencing the folders that SS2K5 makes in the "My Documents" and
where can I change the pointer to another directory.
C:\Documents and Settings\sck10\My Documents\SQL Server Management Studio
Backup
Code Snippets
Projects
Settings
Templates
Thanks,
sck10
"Wei Lu" <weilu@.online.microsoft.com> wrote in message
news:nSxQTvBaGHA.880@.TK2MSFTNGXA01.phx.gbl...
> Hi sck,
> Thanks for using MSDN Managed Newsgroup Support.
> By default, the SQL Management Studio is located at %Program Files
> %\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE
\SqlWb.exe. If you
> moved the SQL Management Studio, please go to the folder and find the
> SqlWb.exe application. What's the result? Do you get any error message?
> Please provide the entire error so that we may do the further
troubleshoot.
> Basically, we do not recommand move the SQL Management Studio folder and
> the Visual Studio 2005 folder directly. This may cause some application
> could not found the referenced files. The best way to move these folder is
> re-install the Visual Studio and the SQL Management Studio.
> Sincerely,
> Wei Lu
> 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.
>|||Hi sck10,
Thanks for the update.
My understanding of your issue is: You want to specify the location when
you create a project/ solution in SQL Management Studio. If I misunderstood
your concern, please feel free to let me know.
You could change the location where your Project store in the location
textbox. Also you can Browse to the location you want to store the project.
By default, SQL Management Studio will create the project in the My
Documents\SQL Server Management Studio\Projects folder.
Hope this will be helpful.
Sincerely,
Wei Lu
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.
--
>From: "sck10" <sck10@.online.nospam>
>References: <#fQKPj6ZGHA.4116@.TK2MSFTNGP05.phx.gbl>
<nSxQTvBaGHA.880@.TK2MSFTNGXA01.phx.gbl>
>Subject: Re: Move SQL Server Management Studio Startup folder
>Date: Wed, 26 Apr 2006 08:52:15 -0500
>Lines: 49
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1807
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807
>Message-ID: <eGEohiTaGHA.1240@.TK2MSFTNGP03.phx.gbl>
>Newsgroups: microsoft.public.sqlserver.server
>NNTP-Posting-Host: 11.202.185.135.in-addr.arpa 135.185.202.11
>Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP03.phx.gbl
>Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.sqlserver.server:429301
>X-Tomcat-NG: microsoft.public.sqlserver.server
>Hi Wei Lu,
>I am referencing the folders that SS2K5 makes in the "My Documents" and
>where can I change the pointer to another directory.
>C:\Documents and Settings\sck10\My Documents\SQL Server Management Studio
>Backup
>Code Snippets
>Projects
>Settings
>Templates
>Thanks,
>sck10
>"Wei Lu" <weilu@.online.microsoft.com> wrote in message
>news:nSxQTvBaGHA.880@.TK2MSFTNGXA01.phx.gbl...
you[vbcol=seagreen]
>troubleshoot.
is[vbcol=seagreen]
>rights.
>
>|||I have the same problem. Allow me to restate the issue from my point of
view, and maybe someone has an answer:
When I am in Management Studio and choose File... Open... File, the
standard Open File dialog box lists 3 icons in the left side: Desktop, My
Projects, and My Computer. The My Projects folder points to My Documents/SQ
L
Server Management Studio/My Projects.
I understand that this is the default location. I would like to CHANGE the
default location to a different folder.
There doesn't seem to be an option to set this default location in the
Management Studio Options. I tried to find the reference in the registry,
but cannot.
Alternatively, I would be happy to be able to ADD my preferred folder to
this dialog

Monday, March 12, 2012

move records from table1 to table2 if does not exist in table3

I want to move records from table1 to table2 if the records in table1 does
not exist in table3
I have following code:
START TRANSACTION
INSERT INTO TABLE2
SELECT * FROM TABLE1
WHERE NOT EXISTS(SELECT * FROM TABLE1, TABLE3
WHERE TABLE1.ID = TABLE3.ID)
DELETE FROM TABLE1
WHERE NOT EXISTS(SELECT * FROM TABLE1, TABLE3
WHERE TABLE1.ID = TABLE3.ID)
IF @.@.ERROR <> 0 THEN
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
should above code work?
Are there any difference to change insert clause like following code?
INSERT INTO TABLE2
SELECT * FROM TABLE1
WHERE NOT EXISTS(SELECT * FROM TABLE2, TABLE3
WHERE TABLE2.ID = TABLE3.ID)
Any information is great appreciated,>> I want to move records [sic] from table1 to table2 if the records
[sic] in table1 does
not exist in table3 <<
First of all, get a book and learn the basics. Records and rows are
totally different concepts. Next, in SQL we do not move things around
like you did with punch card and magnetic tape file sytems in the
1950's.
Tables are not files. A table is the ONLY model of set of the same
kind of things in a schema. Having tables with the same structure is
totally wrong; even Chris date agrees with me on this one! It is that
bad an error.
You need a status code or a rule that classifies your entities into
these magical, undefined 1,2, and 3 categories.|||Thanks for your message.
Are you saying that the tables do not normalize?
I need download a database from a mainframe to my SQL server and give user
information.
Because of security issue, I need store on MS Access database locally and
move to SQL server.
I need move records around.
Database design should follow the business and security rules to resolve
business problems.
It happens in the real world normalization and demalization.
If I am wrong please let me know.
If you could can you please help me on the SQL statements
Thanks again,
"--CELKO--" wrote:

> [sic] in table1 does
> not exist in table3 <<
> First of all, get a book and learn the basics. Records and rows are
> totally different concepts. Next, in SQL we do not move things around
> like you did with punch card and magnetic tape file sytems in the
> 1950's.
> Tables are not files. A table is the ONLY model of set of the same
> kind of things in a schema. Having tables with the same structure is
> totally wrong; even Chris date agrees with me on this one! It is that
> bad an error.
> You need a status code or a rule that classifies your entities into
> these magical, undefined 1,2, and 3 categories.
>|||Hi Souris,
How about this one:
INSERT INTO TABLE2
SELECT * FROM TABLE1 WHERE TABLE1.ID NOT IN (SELECT TABLE3.ID FROM TABLE3)
best Regards,
Chandra
http://chanduas.blogspot.com/
http://www.examnotes.net/gurus/default.asp?p=4223
---
"Souris" wrote:
> Thanks for your message.
> Are you saying that the tables do not normalize?
> I need download a database from a mainframe to my SQL server and give user
> information.
> Because of security issue, I need store on MS Access database locally and
> move to SQL server.
> I need move records around.
> Database design should follow the business and security rules to resolve
> business problems.
> It happens in the real world normalization and demalization.
> If I am wrong please let me know.
> If you could can you please help me on the SQL statements
> Thanks again,
>
>
> "--CELKO--" wrote:
>|||Chandra,
Thanks for the message,
Does you code suport composite keys?
I have 3 primary key fields.
Your help is great appreciated,
"Chandra" wrote:
> Hi Souris,
> How about this one:
> INSERT INTO TABLE2
> SELECT * FROM TABLE1 WHERE TABLE1.ID NOT IN (SELECT TABLE3.ID FROM TABLE3)
>
> --
> best Regards,
> Chandra
> http://chanduas.blogspot.com/
> http://www.examnotes.net/gurus/default.asp?p=4223
> ---
>
> "Souris" wrote:
>|||No! the code does not support composite keys
best Regards,
Chandra
http://chanduas.blogspot.com/
http://www.examnotes.net/gurus/default.asp?p=4223
---
"Souris" wrote:
> Chandra,
> Thanks for the message,
> Does you code suport composite keys?
> I have 3 primary key fields.
> Your help is great appreciated,
>
> "Chandra" wrote:
>|||Hi,
Insert into Table2
Select t1.* From Table1 t1 Left Outer Join Table3 t3 On t1.ID = t3.ID
Where t3.ID is NULL
The above query will perform better and it will also support composite key,
for composite key just add the additional condition on the left outer join
like this:
Insert into Table2
Select t1.* From Table1 t1 Left Outer Join Table3 t3 On t1.ID = t3.ID And
t1.field2 = t3.field2
Where t3.ID is NULL
regards,
Sarav...
"Souris" <Souris@.discussions.microsoft.com> wrote in message
news:0039DB89-389A-4CAA-B9F7-A828B3CFE9B6@.microsoft.com...
>I want to move records from table1 to table2 if the records in table1 does
> not exist in table3
> I have following code:
> START TRANSACTION
> INSERT INTO TABLE2
> SELECT * FROM TABLE1
> WHERE NOT EXISTS(SELECT * FROM TABLE1, TABLE3
> WHERE TABLE1.ID = TABLE3.ID)
> DELETE FROM TABLE1
> WHERE NOT EXISTS(SELECT * FROM TABLE1, TABLE3
> WHERE TABLE1.ID = TABLE3.ID)
> IF @.@.ERROR <> 0 THEN
> ROLLBACK TRANSACTION
> ELSE
> COMMIT TRANSACTION
>
> should above code work?
>
> Are there any difference to change insert clause like following code?
> INSERT INTO TABLE2
> SELECT * FROM TABLE1
> WHERE NOT EXISTS(SELECT * FROM TABLE2, TABLE3
> WHERE TABLE2.ID = TABLE3.ID)
>
> Any information is great appreciated,
>|||Thanks for the inforamtion,
The insert part working
The delete aprt seems does not work.
can you help me on delete part?
"Sarav" wrote:

> Hi,
> Insert into Table2
> Select t1.* From Table1 t1 Left Outer Join Table3 t3 On t1.ID = t3.ID
> Where t3.ID is NULL
> The above query will perform better and it will also support composite key
,
> for composite key just add the additional condition on the left outer join
> like this:
> Insert into Table2
> Select t1.* From Table1 t1 Left Outer Join Table3 t3 On t1.ID = t3.ID And
> t1.field2 = t3.field2
> Where t3.ID is NULL
> regards,
> Sarav...
> "Souris" <Souris@.discussions.microsoft.com> wrote in message
> news:0039DB89-389A-4CAA-B9F7-A828B3CFE9B6@.microsoft.com...
>
>|||>> I need download a database from a mainframe to my SQL server and
give user information. <<
What ETL tools are you using? SQL and ACCESS are different and you
will have problems if you try to put ACCESS betrween the mainframe and
the SQL Server.|||>> Does you code suport composite keys? I have 3 primary key fields
[sic] <<.
INSERT INTO Table2
SELECT *
FROM Table1 AS T1
WHERE NOT EXISTS
(SELECT *
FROM Table3 AS T3
WHERE T3.key_1 = T1.key_1
AND T3.key_2 = T1.key_2
AND T3.key_3 = T1.key_3 );

Friday, March 9, 2012

move msdb

I am getting following error when moving msdb database to different drive.

“SQL SERVER is in SINGLE USER MODE and only one administrator can connect”

I followed steps menthioned in http://support.microsoft.com/kb/224071

Also, it was mentioned that even object browser is also one connection- http://deepakinsql.blogspot.com/2007/08/moving-system-databases-in-sql-2005.html , so I closed that but didn't work.

I am using SQL 2005 Enterprise non clustered with no service pack on windows 2003 server

Did anybody faced this problem and found any solution.

thanks,

Hi
This will help.
http://support.microsoft.com/kb/224071#
|||

I used the same KB article but still getting the error.

Thanks,

|||May be this help?
Stop the SQL Server Agent service before connecting to an instance of SQL Server in single-user mode; otherwise, the SQL Server Agent service uses the connection, thereby blocking it.
|||

After adding ;–c;-m;-T3608 at the end of starup, restart came with SQL Agent not running. So SQL Agent is not running . Moreover I stopped other services like sql browser , Integration service , Analysis service to make sure nobody is connecting. Can I see who is using administrator connection to figure out where it is getting used?

Thanks,

|||STOP SQL SERVICES.
START SQL FROM command prompt

C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn>sqlservr.exe -m
Connect using SQL Management Studio.
|||I have tested above method and it is working on my SQL server 2005 developer edition.

Saturday, February 25, 2012

Move database file

I want to move my database file to a new directory, I search in MS and I use the following steps:

USE master;

SELECT name, physical_name AS CurrentLocation, state_desc

FROM sys.master_files

WHERE database_id = DB_ID(N'test');

ALTER DATABASE test SET OFFLINE;

ALTER DATABASE test

MODIFY FILE ( NAME = test_Log,

FILENAME = 'D:\Databases\test_log.ldf');

ALTER DATABASE test

MODIFY FILE ( NAME = test,

FILENAME = 'D:\Databases\test.mdf');

ALTER DATABASE test

MODIFY FILE ( NAME = test_Log,

FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\test_log.ldf');

ALTER DATABASE test SET ONLINE;

But I had the following errors:

Msg 5120, Level 16, State 101, Line 1

Unable to open the physical file "D:\Databases\test.mdf". Operating system error 5: "5(error not found)".

Msg 5120, Level 16, State 101, Line 1

Unable to open the physical file "D:\Databases\test_log.ldf". Operating system error 5: "5(error not found)".

File activation failure. The physical file name "D:\Databases\test_log.ldf" may be incorrect.

Msg 945, Level 14, State 2, Line 1

Database 'test' cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server errorlog for details.

Msg 5069, Level 16, State 1, Line 1

ALTER DATABASE statement failed.

Can someone tell me how to move my database to another directory (in the same server instance)?

Thanks ina dvance

In between the lines:

ALTER DATABASE test SET OFFLINE;

ALTER DATABASE test

You should make sure to copy the database files to the new location. The errors point to the fact that the files aren't there. You can find step-by-step instructions here:

http://msdn2.microsoft.com/en-us/library/ms345483.aspx

Buck Woody

|||

Try using detach and attach method to copy the datbase file to new location and attach it from the new location.

Much better way to do the same

thankx

Monday, February 20, 2012

Move database file

I want to move my database file to a new directory, I search in MS and I use the following steps:

USE master;

SELECT name, physical_name AS CurrentLocation, state_desc

FROM sys.master_files

WHERE database_id = DB_ID(N'test');

ALTER DATABASE test SET OFFLINE;

ALTER DATABASE test

MODIFY FILE ( NAME = test_Log,

FILENAME = 'D:\Databases\test_log.ldf');

ALTER DATABASE test

MODIFY FILE ( NAME = test,

FILENAME = 'D:\Databases\test.mdf');

ALTER DATABASE test

MODIFY FILE ( NAME = test_Log,

FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\test_log.ldf');

ALTER DATABASE test SET ONLINE;

But I had the following errors:

Msg 5120, Level 16, State 101, Line 1

Unable to open the physical file "D:\Databases\test.mdf". Operating system error 5: "5(error not found)".

Msg 5120, Level 16, State 101, Line 1

Unable to open the physical file "D:\Databases\test_log.ldf". Operating system error 5: "5(error not found)".

File activation failure. The physical file name "D:\Databases\test_log.ldf" may be incorrect.

Msg 945, Level 14, State 2, Line 1

Database 'test' cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server errorlog for details.

Msg 5069, Level 16, State 1, Line 1

ALTER DATABASE statement failed.

Can someone tell me how to move my database to another directory (in the same server instance)?

Thanks ina dvance

In between the lines:

ALTER DATABASE test SET OFFLINE;

ALTER DATABASE test

You should make sure to copy the database files to the new location. The errors point to the fact that the files aren't there. You can find step-by-step instructions here:

http://msdn2.microsoft.com/en-us/library/ms345483.aspx

Buck Woody

|||

Try using detach and attach method to copy the datbase file to new location and attach it from the new location.

Much better way to do the same

thankx