Tuesday, March 27, 2012
can't start sql2000, Database 'model' cannot be opened. It is in the middle of a restor
Database 'model' cannot be opened. It is in the middle of a restore.
Anyone can help me ?
Pedro MetelloYou can possibly use traceflags 3607, 3608 or 3609 to start model without recovery. However, you
need to search the net for articles describing this. Seems like MS removed these from KB... :-(
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"FRISSUL" <frissul@.frissul.pt> wrote in message news:uw6AaiTnDHA.3504@.TK2MSFTNGP11.phx.gbl...
> I can't start Sql server 2000, in the event viewer is the folowing message.
> Database 'model' cannot be opened. It is in the middle of a restore.
>
> Anyone can help me ?
>
> Pedro Metello
>|||thanks, but when I start with
SQLSERVR -T3609
it says:
"BYPASSING RECOVERY FOR DATABASE 'MODEL' BECAUSE IT IS MARKED IN LOAD"
and then
"Database 'model' cannot be opened. It is in the middle of a restore."
Pedro Metello
"Tibor Karaszi" <tibor.please_reply_to_public_forum.karaszi@.cornerstone.se>
wrote in message news:uQ7fBuTnDHA.3504@.TK2MSFTNGP11.phx.gbl...
> You can possibly use traceflags 3607, 3608 or 3609 to start model without
recovery. However, you
> need to search the net for articles describing this. Seems like MS removed
these from KB... :-(
> --
> Tibor Karaszi, SQL Server MVP
> Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
>
> "FRISSUL" <frissul@.frissul.pt> wrote in message
news:uw6AaiTnDHA.3504@.TK2MSFTNGP11.phx.gbl...
> > I can't start Sql server 2000, in the event viewer is the folowing
message.
> >
> > Database 'model' cannot be opened. It is in the middle of a restore.
> >
> >
> >
> > Anyone can help me ?
> >
> >
> >
> > Pedro Metello
> >
> >
>|||Too bad. There goes that option. I'm out of ideas. I assume you have searched KB and the archives.
So unless someone else comes up with any ideas, it might be worth opening a case with MS support.
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"FRISSUL" <frissul@.frissul.pt> wrote in message news:eZHqd5UnDHA.1740@.TK2MSFTNGP12.phx.gbl...
> thanks, but when I start with
> SQLSERVR -T3609
> it says:
> "BYPASSING RECOVERY FOR DATABASE 'MODEL' BECAUSE IT IS MARKED IN LOAD"
> and then
> "Database 'model' cannot be opened. It is in the middle of a restore."
> Pedro Metello
>
> "Tibor Karaszi" <tibor.please_reply_to_public_forum.karaszi@.cornerstone.se>
> wrote in message news:uQ7fBuTnDHA.3504@.TK2MSFTNGP11.phx.gbl...
> > You can possibly use traceflags 3607, 3608 or 3609 to start model without
> recovery. However, you
> > need to search the net for articles describing this. Seems like MS removed
> these from KB... :-(
> >
> > --
> > Tibor Karaszi, SQL Server MVP
> > Archive at:
> http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
> >
> >
> > "FRISSUL" <frissul@.frissul.pt> wrote in message
> news:uw6AaiTnDHA.3504@.TK2MSFTNGP11.phx.gbl...
> > > I can't start Sql server 2000, in the event viewer is the folowing
> message.
> > >
> > > Database 'model' cannot be opened. It is in the middle of a restore.
> > >
> > >
> > >
> > > Anyone can help me ?
> > >
> > >
> > >
> > > Pedro Metello
> > >
> > >
> >
> >
>
Thursday, March 22, 2012
Can't seem to get ASP and SQL2000 to recognize the User IUSR_MachineName
strConnect =3D "Provider=3DSQLOLEDB.1;User = ID=3DIUSER_MachineName;Trusted_Connection=3Dyes;Initial = Catalog=3Dmy_logon;" & _
"Network Library=3Ddbmssocn;Data Source=3DMyServer"
I have IUSR_MachineName as a User in the database and in Security for = Logins for the SQL 2000 SP3 server.
Since I don't know what the password is for the IUSR_MachineName account = I am assuming I could use TrustedConnection=3D"yes"
But this is not working. I keep getting:
Microsoft OLE DB Provider for SQL Server (0x80040E09)
SELECT permission denied on object 'Users', database 'my_logon', owner = 'dbo'.
In fact if I just use:
strConnect =3D "Provider=3DSQLOLEDB.1;Trusted_Connection=3Dyes;Initial = Catalog=3Dmy_logon;" & _
"Network Library=3Ddbmssocn;Data Source=3DMyServer"
I get the same error. The only way I can connect using ASP is using the = sa account or my Administrator account with the password. What am I = doing wrong and how can I get the account to be used to be the = IUSR_MachineName account given that IIS 5 (Windows 2000 Server SP3) = controls the password and I know not what it is? Thanks.
-- George Hester
__________________________________>>
Since I don't know what the password is for the IUSR_MachineName account I
am assuming I could use TrustedConnection="yes"
No, this won't work... you can't have a trusted connection *and* specify the
userid. You will need to do one of the following things:
(a) use a SQL Server user in your connection string.
(b) if you want to use a trusted connection, you will need to set up the
passwords correctly. The IUSR account on your web server is *only* on your
web server. The SQL Server machine has no idea who IUSR_webserver is, so
even if you add that user to SQL Server, the passwords won't synchronize.
In Windows 2000, I believe there was a setting in IIS to disable automatic
password synchronization for the IUSR account, and override the password.
Otherwise, you will have to change the password in password in
Administrative Tools / Computer Management / Local Users and Groups / Users.
Once the web server has a password for IUSR_webserver that you know, you can
do one of two things:
(i) use a connection string with *only* trusted connection=yes (no userid
information - see a sample at http://www.aspfaq.com/2126) and make sure that
windows authentication is disabled
(ii) add the same username/password as a SQL Server user, and include the
user id and password in the connection string (and remove the trusted
connection bit).
--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/|||Hi Aaron. Ok I see it won't work as I was hoping. Too bad I can't just =send the IIS generated password to SQL. That would make life so much =easier.
But one thing I am noticing. If I add my Windows logon account =MyDomain\Administrator to the logons for the SQL Server and for the =databases then I have for the logon of a database say Northwind =MyDomain\Administrator. I also have BUILTIN\Administrators for logon to =the SQL Server and in the databases.
If I go to Query Analyzer and choose SQL Authentication and type in =MyDomain\Administrator and my Windows 2000 SP3 Administrator password I =cannot connect. But if I choose Windows authentication then the account =which is used to logon to the SQL Server is MyDomain\Administrator.
This is confusing to me. Why when I try to login using Query Analyzer =using SQL authentication and the Login name MyDomain\Administrator I =cannot connect? But if I use Windows authentication the login name =shows as MyDomain\Administrator? This doesn't make sense to me.
It seems to me that all the Users that I have in my Users in Windows =2000 SP3 if I add them to SQL Server as it gives me the capability to, =then I cannot use those accounts to login to SQL 2000 SP3 Server. =Unless I have signed into Windows 2000 using one of those accounts. If =I have not signed into Windows 2000 SP3 using one of those accounts then =they are worthless to sign into SQL 2000 SP3. Thanks.
-- George Hester
__________________________________
"Aaron Bertrand [MVP]" <aaron@.TRASHaspfaq.com> wrote in message =news:#57kO8dwDHA.1764@.TK2MSFTNGP10.phx.gbl...
> >>
> Since I don't know what the password is for the IUSR_MachineName =account I
> am assuming I could use TrustedConnection=3D"yes"
> >>
> > No, this won't work... you can't have a trusted connection *and* =specify the
> userid. You will need to do one of the following things:
> > (a) use a SQL Server user in your connection string.
> > (b) if you want to use a trusted connection, you will need to set up =the
> passwords correctly. The IUSR account on your web server is *only* on =your
> web server. The SQL Server machine has no idea who IUSR_webserver is, =so
> even if you add that user to SQL Server, the passwords won't =synchronize.
> In Windows 2000, I believe there was a setting in IIS to disable =automatic
> password synchronization for the IUSR account, and override the =password.
> Otherwise, you will have to change the password in password in
> Administrative Tools / Computer Management / Local Users and Groups / =Users.
> > Once the web server has a password for IUSR_webserver that you know, =you can
> do one of two things:
> > (i) use a connection string with *only* trusted connection=3Dyes (no =userid
> information - see a sample at http://www.aspfaq.com/2126) and make =sure that
> windows authentication is disabled
> > (ii) add the same username/password as a SQL Server user, and include =the
> user id and password in the connection string (and remove the trusted
> connection bit).
> > -- > Aaron Bertrand
> SQL Server MVP
> http://www.aspfaq.com/
> >|||On Sat, 13 Dec 2003 20:35:04 -0500, "George Hester"
<hesterloli@.hotmail.com> wrote:
>Hi Aaron. Ok I see it won't work as I was hoping. Too bad I can't just send the IIS generated password to SQL. That would make life so much easier.
>But one thing I am noticing. If I add my Windows logon account MyDomain\Administrator to the logons for the SQL Server and for the databases then I have for the logon of a database say Northwind MyDomain\Administrator. I also have BUILTIN\Administrators for logon to the SQL Server and in the databases.
>If I go to Query Analyzer and choose SQL Authentication and type in MyDomain\Administrator and my Windows 2000 SP3 Administrator password I cannot connect. But if I choose Windows authentication then the account which is used to logon to the SQL Server is MyDomain\Administrator.
>This is confusing to me. Why when I try to login using Query Analyzer using SQL authentication and the Login name MyDomain\Administrator I cannot connect? But if I use Windows authentication the login name shows as MyDomain\Administrator? This doesn't make sense to me.
>It seems to me that all the Users that I have in my Users in Windows 2000 SP3 if I add them to SQL Server as it gives me the capability to, then I cannot use those accounts to login to SQL 2000 SP3 Server. Unless I have signed into Windows 2000 using one of those accounts. If I have not signed into Windows 2000 SP3 using one of those accounts then they are worthless to sign into SQL 2000 SP3. Thanks.
Hi George,
You can achieve what you want if you change the security attributes on
your website to disallow Everyone and the anonymous user, and allow a
specific domain group, where that domain group includes the people you
have given access to SQL Server.
This will make IIS prompt the browser for authentication information. If
your users are using Internet Explorer and are logged into the domain,
then authentication will be transparent, otherwise they will be prompted
to enter their username and password.
They will then be authenticated in IIS as themselves, instead of the
anonymous user, and the secure connection to SQL Server will also be as
themselves.
cheers,
Ross.
--
Ross McKay, WebAware Pty Ltd
"Words can only hurt if you try to read them. Don't play their game" - Zoolander|||>> This is confusing to me. Why when I try to login using Query Analyzer
using SQL authentication and the Login name MyDomain\Administrator I cannot
connect?
Because this is not a SQL user! This is a Windows user! If you are logged
in as MyDomain\Administrator, use Windows Authentication. Otherwise, use a
SQL user account.
--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/|||> You can achieve what you want if you change the security attributes on
> your website to disallow Everyone and the anonymous user, and allow a
> specific domain group, where that domain group includes the people you
> have given access to SQL Server.
> This will make IIS prompt the browser for authentication information. If
> your users are using Internet Explorer and are logged into the domain,
> then authentication will be transparent, otherwise they will be prompted
> to enter their username and password.
> They will then be authenticated in IIS as themselves, instead of the
> anonymous user, and the secure connection to SQL Server will also be as
> themselves.
Great addition Ross.
--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/|||Aha finally. I got it from here:
http://support.microsoft.com/default.aspx?scid=3Dkb;en-us;247931&Product=3D=
sql
To use the IUSR_MachineName account and SQLOLEDB (note the missing .1) =I have to have "Integrated Security=3DSSPI" in the connection string. I =also have to have in SQL 2000 SP3 MyDomain\IUSR_MachineName have =db_datareader and db_datawriter access to the my_logon database. The =account must also have db_datareader and db_datawriter permissions to =the tempdb database. Also the account must be set up with Windows =Authentication which makes sense.
So the connection string is:
strConnect =3D "Provider=3DSQLOLEDB;Integrated Security=3DSSPI;Initial =Catalog=3Dmy_logon;" & _
"Network Library=3Ddbmssocn;Data Source=3DMySQLServer"
Now this article says "You must use one of the following two IIS =authentication methods:"
Actually I wanted to use the first method. Looks easier. But it was =not correct. I removed the Anonymous access and left only Basic =Authentication as the article suggests. I was returned a Domain logon =when I tried to access the web application. That I did not want. Also =the error was the AddHeader was insufficient information. Well that was =easy to fix. Just put back in the Anonymous account whose password is =handled by IIS.
That seems to have done it.
I can connect. Now to just finish with this article:
http://support.microsoft.com/?scid=3Dkb;en-us;299987
whew!!
-- George Hester
__________________________________
"Aaron Bertrand [MVP]" <aaron@.TRASHaspfaq.com> wrote in message =news:#57kO8dwDHA.1764@.TK2MSFTNGP10.phx.gbl...
> >>
> Since I don't know what the password is for the IUSR_MachineName =account I
> am assuming I could use TrustedConnection=3D"yes"
> >>
> > No, this won't work... you can't have a trusted connection *and* =specify the
> userid. You will need to do one of the following things:
> > (a) use a SQL Server user in your connection string.
> > (b) if you want to use a trusted connection, you will need to set up =the
> passwords correctly. The IUSR account on your web server is *only* on =your
> web server. The SQL Server machine has no idea who IUSR_webserver is, =so
> even if you add that user to SQL Server, the passwords won't =synchronize.
> In Windows 2000, I believe there was a setting in IIS to disable =automatic
> password synchronization for the IUSR account, and override the =password.
> Otherwise, you will have to change the password in password in
> Administrative Tools / Computer Management / Local Users and Groups / =Users.
> > Once the web server has a password for IUSR_webserver that you know, =you can
> do one of two things:
> > (i) use a connection string with *only* trusted connection=3Dyes (no =userid
> information - see a sample at http://www.aspfaq.com/2126) and make =sure that
> windows authentication is disabled
> > (ii) add the same username/password as a SQL Server user, and include =the
> user id and password in the connection string (and remove the trusted
> connection bit).
> > -- > Aaron Bertrand
> SQL Server MVP
> http://www.aspfaq.com/
> >|||Well I don't see why. SQL Manager clearly shows that =MyDomain\Administrator has login permissions. Well never mind. I got =it fixed. Thanks anyway.
-- George Hester
__________________________________
"Aaron Bertrand [MVP]" <aaron@.TRASHaspfaq.com> wrote in message =news:ezC#ycewDHA.1756@.TK2MSFTNGP09.phx.gbl...
> >> This is confusing to me. Why when I try to login using Query =Analyzer
> using SQL authentication and the Login name MyDomain\Administrator I =cannot
> connect?
> > Because this is not a SQL user! This is a Windows user! If you are =logged
> in as MyDomain\Administrator, use Windows Authentication. Otherwise, =use a
> SQL user account.
> > -- > Aaron Bertrand
> SQL Server MVP
> http://www.aspfaq.com/
> >|||>> I have to have "Integrated Security=SSPI" in the connection string.
Yep, in my first reply:
http://www.aspfaq.com/2126
You can see this:
<snip>
Using Windows Authentication:
<%
cst = "Provider=SQLOLEDB.1;Data Source=<server/ip>;" & _
"Initial Catalog=<dbname>;Integrated Security=SSPI"
set conn = CreateObject("ADODB.Connection")
conn.open cst
%>
</snip>
Tuesday, March 20, 2012
can't see the sql 2005 box from sql 2000 box
2000. I could see the 2k box from 2005 but not the other way. Is there
something i'm missing or it's not doable? Please let me know. Also, i can't
replicate from 2000 to 2005, right? can i replicate from 2005 to 2000? thank
you very much for your help...
Tejas
Tejas,
this article will explain the compatibility between different versions:
http://msdn2.microsoft.com/en-us/library/ms143241.aspx
As for setting up the SQL 2005 subscription to a 2000 publisher, you can set
this up by registering your 2000 publisher in Management Studio.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||I actually have problems even before doing all this. I can't even register my
2005 box in 2000 SQL EM. I can register the 2000 box in 2005 though. To do
this, I'm using SQL authentication. I have created usernames in both servers.
I dont know if it's doable. Please let me know. Thank you for the article
though.
I will be able to use Transactional(1 way) i assume since my pub/dist is
2000 and sub will be 2005. Please let me know if i understand this crrrectly.
thank you.
|||Tejas,
I probably didn't explain myself clearly - what I was meaning is that you
can register the 2000 SQL Server in SSMS and then create the publication on
the 2000 box using SSMS.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||Hey Paul. I might be missing something maybe. I'll explain to you what i did.
I registered the 2000 box in SSMS. I created a Trans. publication (1 way)
from there. The publisher and dist side is setup. Now I wanted to add a pull
subscription from 2005 box.
What I did was, I went to the publisher properties on the 2000 box, went to
subscribers and tried to add a subscriber there. I supplied the instance
name, SQL authentication etc. for the 2005 box, but it gives me an error
saying
"SQL Server replication requires the actual server name to make a connection
to the server. Connections through a server alias, IP address, or any other
alternate name are not supported. Specify the actual server name, ''.
(Replication.Utilities)
I can ping my 2005 box but can't see SQL on that box from any 2000 boxes.
They are on different windows domain if that makes any difference for SQL
authentication. Please let me know how i would add this subscriber and
subscribe a 2005 box to a 2000 publication.
thank you, paul
Regards,
Tejas Parikh
|||Tejas,
I'll just install SQL 2000 on my 2005 Virtual PC then try to repro this.
Rgds,
Paul
"Tejas Parikh" <TejasParikh@.discussions.microsoft.com> wrote in message
news:258DC9E3-EA16-4A7B-AF7A-2BB853B26529@.microsoft.com...
> Hey Paul. I might be missing something maybe. I'll explain to you what i
> did.
> I registered the 2000 box in SSMS. I created a Trans. publication (1 way)
> from there. The publisher and dist side is setup. Now I wanted to add a
> pull
> subscription from 2005 box.
> What I did was, I went to the publisher properties on the 2000 box, went
> to
> subscribers and tried to add a subscriber there. I supplied the instance
> name, SQL authentication etc. for the 2005 box, but it gives me an error
> saying
> "SQL Server replication requires the actual server name to make a
> connection
> to the server. Connections through a server alias, IP address, or any
> other
> alternate name are not supported. Specify the actual server name, ''.
> (Replication.Utilities)
> I can ping my 2005 box but can't see SQL on that box from any 2000 boxes.
> They are on different windows domain if that makes any difference for SQL
> authentication. Please let me know how i would add this subscriber and
> subscribe a 2005 box to a 2000 publication.
> thank you, paul
> Regards,
> Tejas Parikh
|||Tejas,
I have no problem registering SQL 2005 as a subscriber on my SQP 2000
Publisher box. In fact, I didn't have to register the server in Enterprise
Manager as a SQL Server - it was automatically picked up. As a variation, I
could also create the subscription directly (including having the subscriber
added as I verified from the generated script) from within SSMS. You might
want to try it that way instead.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||Hey Paul. I thought it should be that easy. but my EM doesn't pick it up. I
try to register it and it gives me an error saying the server doesn't exist
or access denied. the username i'm trying to use is a sysadmin on the 2005
box. Do i have to check something in Windows or i'm just crazy to not get it
to work? thank you for your time and help, Paul.
|||Tejas,
have a look in the SQL Server Configuration Manager on the 2005 box and
check onn the protocol properties that the instance isn't hidden. Also, on
the 2000 box, you say that pinging the 2005 box works - is this using the IP
address or the netbios name? If the IP address, then I wonder if a full
trust relationship exists between your domains? What happens if you ping the
netbiosname instead? If this doesn't work, then I think you'll need an alias
set up on the publisher for the subscriber, and an entry in the hosts file.
Also I can't tell if you've tried setting up the subscription while using
SSMS - both push and pull would be interesting.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
Can't see Mapped Drives in Database Maintenance tool!
I am using the Database Maintenance tool to backup selected databases. I
realized the only drives I can save these backups to are the local drives. We
don't have enough space on these local drives, so is there anyway to see the
network mapped drives for this procedure?
Thanks,
Ted
Don't use a mapped drive. Use the UNC pathing instead. You need to ensure
the account SQL Server is running under has permissions to read and write to
this share first.
http://support.microsoft.com/kb/555128
Andrew J. Kelly SQL MVP
"Infomax" <Infomax@.discussions.microsoft.com> wrote in message
news:EBB765BE-0A41-456C-9615-C6AB069AAADB@.microsoft.com...
>I have SQL2000 & SQL2005 running on Windows 2003 servers.
> I am using the Database Maintenance tool to backup selected databases. I
> realized the only drives I can save these backups to are the local drives.
> We
> don't have enough space on these local drives, so is there anyway to see
> the
> network mapped drives for this procedure?
> Thanks,
> Ted
Monday, March 19, 2012
Can't run under the Eval version of Sql2000
When I install the evaluation version of Reporting Service, the Installer
require me a SqlServer with Server pack 3a
But the Server pack 3a can't install with evaluation version of SQL Server
2000
How can I do?I guess theres nothing much you can do in this case :(
>--Original Message--
>I install the evaluation version of SQL Server 2000.
>When I install the evaluation version of Reporting
Service, the Installer
>require me a SqlServer with Server pack 3a
>But the Server pack 3a can't install with evaluation
version of SQL Server
>2000
>How can I do?
>
>.
>|||Actually, that's not correct. You can install SQL Server 2000 Service Pack
3a on the Evaluation Edition. See
http://www.microsoft.com/sql/downloads/2000/sp3.asp, a section of which is
copied below:
SQL Server 2000 SP3a:
a.. Improves serviceability for SQL Server 2000 Evaluation Edition. SP3a
enables service pack upgrades for trial software. In the past, service packs
have not been applicable to trial software.
--
Sincerely,
Stephen Dybing
This posting is provided "AS IS" with no warranties, and confers no rights.
"ad" <ad@.wfes.tcc.edu.tw> wrote in message
news:u1hHCavjEHA.2652@.TK2MSFTNGP15.phx.gbl...
>I install the evaluation version of SQL Server 2000.
> When I install the evaluation version of Reporting Service, the Installer
> require me a SqlServer with Server pack 3a
> But the Server pack 3a can't install with evaluation version of SQL Server
> 2000
> How can I do?
>
Thursday, March 8, 2012
Can't replicate with DB on LAN
I'm doing merge replication sql2000 to sql2000, handled programatically
in my c# application.
Everything is working perfectly when the publisher and subscriber are
on the same SQL Server registration, but not when I try to replicate
with SQL Server on our server.
The Server DB registration is listed in my local Enterprise Manager.
In my application, the working version of my setup includes these
variables:
// Publisher Info
private string strPublisher = "BCN"; //the local machine name
private string strPublisherAddress ="localhost"; // the local machine
private string strPublisherDatabase ="Pub1";
But if I simply change the publisher name:
// Publisher Info
private string strPublisher = "MON"; //the server machine name
I get an unspecified error.
- The DB Instance names are identical to the server names.
- Using TCP-IP Network protocol, tried Multi-protocol to no avail.
Can anyone help? I am really stuck at this point.
Thanks,
JJ
Update - If I switch away from TCP-IP to Default Network, it works.
I wonder how well it will work when I go back to TCP-IP when i test the
app's connection over a WAN.
JJ
Saturday, February 25, 2012
Cant pass search text into Stored Procedure
I am trying to inject dynamically generated text into a Sql2000 stored procedure. What am I doing wrong?
A code behind routine generates the following string value based on a visitor entering 'sail boats' in TextBox1. The routine splits the entry and creates the below string.
Companies.L_Keywords LIKE '%sail%' AND Companies.L_Keywords LIKE '%boats%'
I am trying to place this string result in the WHERE statement of a Sql2000 Stored Procedure using parameter @.VisitorKeywords.
PROCEDURE dbo.KWsearch
AS
SELECT DISTINCT Companies.L_Name, Companies.L_ID, Companies.L_Enabled
WHERE ( @.visitorKeywords ) AND (Companies.L_Enabled = 1)
ORDER BY Companies.L_Name
I am wanting the resulting WHERE portion to be:
WHERE ( Companies.L_Keywords LIKE '%sail%' AND Companies.L_Keywords LIKE '%boats%' ) AND (Companies.L_Enabled = 1)
Thank you
I noticed your starting character is '%something..'. Realize that this may not use any indexes on the L_Keywords column. Because your first character itself is a wildcard, SQL Server does not know where to start so it will not use the index. In order for indexes to be used the query should be like: 'something%'. Your query should look like this: Pass just the value to the proc. The value coming from your app for @.keyword1 would be '%sail%'.
SELECT DISTINCT Companies.L_Name, Companies.L_ID, Companies.L_EnabledWHERE ( Companies.L_KeywordsLIKE @.KeyWord1AND Companies.L_KeywordsLIKE @.KeyWord2 )AND (Companies.L_Enabled = 1)ORDER BY Companies.L_Name
|||
I was able to pass in the values but I need to pass in the entire string because the number of LIKE statements is determined by the number of keywords the user enters. If they enter "sail boats", I need two LIKE statements but if they enter "big blue sail boats" I need four LIKE statements. That is why I was trying to pass in the entire string.
|||
Is it possible to pass a partial SQL statement string into a stored procedure and concantenate it with the resident code using a parameter?
|||Yes you'd have to use dynamic SQL. Check out this article before attempting to do so:http://www.sommarskog.se/dynamic_sql.html
|||Below is the routine I am using to create the partial WHERE statement. Does it present a secuity risk? I assumed that programically generating the SELECT in this way would offer greatly improved security.
What I am trying to do is pass the strings produced by this routine into the Stored Procedure I use to access the database.
protectedvoid KeyWordSqlSelect(){
kwdString = UserKeyword.Text;
Criteria1 ="";
Criteria2 ="";
string[] ArrKwdString = System.Text.RegularExpressions.Regex.Split(kwdString," ");
int iCount = 0;
foreach (string sValuein ArrKwdString)
{
Criteria1 +=string.Format("tblCompany.L_Keywords LIKE '%{0}%'", sValue);
Criteria2 +=string.Format("tblFranchise.L_Keywords LIKE '%{0}%'", sValue);
if ((iCount + 1) < ArrKwdString.Length)
Criteria1 +=" AND ";
Criteria2 +=" AND ";
iCount += 1;
CKWsearch = Criteria1;
SKWsearch = Criteria2;
TextBox1.Text = Criteria1;
TextBox2.Text = Criteria2;
}
}
|||Please check out the article link I posted. There's risks/performance issues that you need to get an understanding of with dynamic SQL.
|||I read the article but do not see what risk you are suggesting. If the partial WHERE string is generated within the C# code I do not see the injection risk unless there is a problem with the " " space delimiter used in the Split method for the incoming keyword string.
|||
The biggest risk is the SQL Injection attack. Performance issues include bad query plans, not storing query plans if you dont use sp_Executesql etc.
|||I somewhat understand what you are talking about now (only after reading the article three times). I have abandoned the stored procedure and now am generating the Select statements in the code behind accessing them directly using SqlCommand object. I am hoping that will protect me from injection attacks as none of them are exposed to the users. Thank you for the expert advice. Sql is not a place for amateurs like myself to be mucking about. Your sage advice is greatly appreciated.
|||Welcome. Glad to help.
Sunday, February 19, 2012
cant login
I installed sql2000 dev edition on XP professional.i created a login in
sql.but whenver try to login to sql it says "this login is not associated
with trusted connection" and i cant login!!
am wondering how to fix that.
Thanks
Cheers
cheers
Hi
SQL Server is only setup to be using NT Integrated security.
On the Server Properties page, you can configure SQL Server to be "Mixed
Mode" and restart SQL Server.
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"rajani" <rajani@.discussions.microsoft.com> wrote in message
news:B8A81541-B555-430E-8067-4F2C00BB24EE@.microsoft.com...
> Hi friends
> I installed sql2000 dev edition on XP professional.i created a login in
> sql.but whenver try to login to sql it says "this login is not associated
> with trusted connection" and i cant login!!
> am wondering how to fix that.
> Thanks
> Cheers
> --
> cheers
|||Thanks Mike.
i was looking for that option everywhere.
cheers
"Mike Epprecht (SQL MVP)" wrote:
> Hi
> SQL Server is only setup to be using NT Integrated security.
> On the Server Properties page, you can configure SQL Server to be "Mixed
> Mode" and restart SQL Server.
> Regards
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "rajani" <rajani@.discussions.microsoft.com> wrote in message
> news:B8A81541-B555-430E-8067-4F2C00BB24EE@.microsoft.com...
>
>
|||I'm still looking
...can you tell me where you found it? I'm notsure where the Server Properties page is...
jared
On Sun, 10 Jul 2005 21:25:01 -0700, rajani
<rajani@.discussions.microsoft.com> wrote:
>Thanks Mike.
>i was looking for that option everywhere.
|||Hi jaredea
if u open enterprise manager on left hand side look for ur server name(under
"sql server group")
normally server names (local), server etc.,
right click and properties and go to security tab and you'll find it there.
if u still cant find it then send me ur emailid i will send u screenshot
cheers
"jaredea" wrote:
> I'm still looking
...can you tell me where you found it? I'm not> sure where the Server Properties page is...
> jared
> On Sun, 10 Jul 2005 21:25:01 -0700, rajani
> <rajani@.discussions.microsoft.com> wrote:
>
>
cant login
I installed sql2000 dev edition on XP professional.i created a login in
sql.but whenver try to login to sql it says "this login is not associated
with trusted connection" and i cant login!!
am wondering how to fix that.
Thanks
Cheers
--
cheersHi
SQL Server is only setup to be using NT Integrated security.
On the Server Properties page, you can configure SQL Server to be "Mixed
Mode" and restart SQL Server.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"rajani" <rajani@.discussions.microsoft.com> wrote in message
news:B8A81541-B555-430E-8067-4F2C00BB24EE@.microsoft.com...
> Hi friends
> I installed sql2000 dev edition on XP professional.i created a login in
> sql.but whenver try to login to sql it says "this login is not associated
> with trusted connection" and i cant login!!
> am wondering how to fix that.
> Thanks
> Cheers
> --
> cheers|||Thanks Mike.
i was looking for that option everywhere.
--
cheers
"Mike Epprecht (SQL MVP)" wrote:
> Hi
> SQL Server is only setup to be using NT Integrated security.
> On the Server Properties page, you can configure SQL Server to be "Mixed
> Mode" and restart SQL Server.
> Regards
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "rajani" <rajani@.discussions.microsoft.com> wrote in message
> news:B8A81541-B555-430E-8067-4F2C00BB24EE@.microsoft.com...
>
>|||I'm still looking
...can you tell me where you found it? I'm notsure where the Server Properties page is...
jared
On Sun, 10 Jul 2005 21:25:01 -0700, rajani
<rajani@.discussions.microsoft.com> wrote:
>Thanks Mike.
>i was looking for that option everywhere.|||Hi jaredea
if u open enterprise manager on left hand side look for ur server name(under
"sql server group")
normally server names (local), server etc.,
right click and properties and go to security tab and you'll find it there.
if u still cant find it then send me ur emailid i will send u screenshot
--
cheers
"jaredea" wrote:
> I'm still looking
...can you tell me where you found it? I'm not> sure where the Server Properties page is...
> jared
> On Sun, 10 Jul 2005 21:25:01 -0700, rajani
> <rajani@.discussions.microsoft.com> wrote:
>
>
Tuesday, February 14, 2012
Can't Install SQL 2000 service pack 4
We are having trouble installing SQL2000 service pack 4 on our server. The package runs through and looks like it installs files to c:\, but the install never asks us for any of the questions regarding the install of service pack 4. One issue we were thinking about was that MSDE was installed on the server also. We have a 2003 server with SQL 2000 sp3 (8.00.760)
Are you running this through a command line or through the UI? If it is command line, can you supply the command line you are running?
Thanks,
Sam Lester (MSFT)
cant install mssql2000
1. Local machine -> next
2. Create a new instance of SQL server -> next
3. type name and company -> next
4. accept -> next
5. Server and client tools -> next
6. Default -> next
7. Typical -> next
8. use the same account ... and Use the Local system account -> next
9. Mixed mode , passward -> next
whatever options i choose, the installation program of sql will exit
after step9. just don't know what the problem is. please help thanks:)pc_newbie (ay@.computermail.net) writes:
> Hi, i am having problem to install sql2000 server, the steps i did are:
> 1. Local machine -> next
> 2. Create a new instance of SQL server -> next
> 3. type name and company -> next
> 4. accept -> next
> 5. Server and client tools -> next
> 6. Default -> next
> 7. Typical -> next
> 8. use the same account ... and Use the Local system account -> next
> 9. Mixed mode , passward -> next
> whatever options i choose, the installation program of sql will exit
> after step9. just don't know what the problem is. please help thanks:)
In C:\WINDOWS\sqlstp.log there is a log of the setup program. That
file might give some clues.
For further information, it would help if you told us which operating
system you are using, and what regional settings you have. Also, please
tell if you are using any non-English version of SQL Server.
A tip is also to frequent the group microsoft.public.sqlserver.setup.
Myself, I install SQL Server only occassionally, so I don't have much
experience of setup problems myself.
--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Erland Sommarskog wrote:
> pc_newbie (ay@.computermail.net) writes:
>>Hi, i am having problem to install sql2000 server, the steps i did are:
>>1. Local machine -> next
>>2. Create a new instance of SQL server -> next
>>3. type name and company -> next
>>4. accept -> next
>>5. Server and client tools -> next
>>6. Default -> next
>>7. Typical -> next
>>8. use the same account ... and Use the Local system account -> next
>>9. Mixed mode , passward -> next
>>
>>whatever options i choose, the installation program of sql will exit
>>after step9. just don't know what the problem is. please help thanks:)
>
> In C:\WINDOWS\sqlstp.log there is a log of the setup program. That
> file might give some clues.
> For further information, it would help if you told us which operating
> system you are using, and what regional settings you have. Also, please
> tell if you are using any non-English version of SQL Server.
> A tip is also to frequent the group microsoft.public.sqlserver.setup.
> Myself, I install SQL Server only occassionally, so I don't have much
> experience of setup problems myself.
Erland, Thank you ver much, i have fixed the problem already, it's
because of locale setting. thanks again :)