|
At the Enterprise Manager, when I click on a particular database, the error message was:
Internet Explorer Script Error
An error has occurred in the script on this page
Line 307
Char 2
Error: Unspecified error
code: 0
url: res//C:\Program%20Files\Microsoft%20SQL%20Server\80\Tools\Binn\Resources\1033\sqlmmc.rll\Tabs.html
Clicking on other databases doesn't yield this problem. I have tried deleting the database, restoring it. Even tried using wizard to create a new database and add back all the files but the error still persist.
Any way I can get rid of the error. I still can work on the tables but it is irritating as it will pop up now and then.
|
|
|
|
|
Dear friends
i have a database which has a lot of columns and unfortunately all columns has a some null input.
Database has a lot of columns and it is not easy to write in where criteria all field.
I need if is possible a query like this all of in database table which data is null change it with "NO INPUT" string.
If i can take your valuable advice(s) i will be very glad.
Thanks a lot
|
|
|
|
|
MAGICIANMERLIN wrote:
I need if is possible a query like this all of in database table which data is null change it with "NO INPUT" string.
That's not an easy query. Why not try your first option?
MAGICIANMERLIN wrote:
write in where criteria all field
With a little lateral thinking this can be achieved in less than 5 minutes.
SELECT 'UPDATE ['+TABLE_SCHEMA+'].['+TABLE_NAME+'] SET ['+COLUMN_NAME+
']=''NO INPUT'' WHERE ['+COLUMN_NAME+'] IS NULL;'
FROM INFORMATION_SCHEMA.COLUMNS
WHERE IS_NULLABLE='YES' AND DATA_TYPE IN('char','nchar','varchar','nvarchar')
Basically, this is a query that will generate a SQL script. Run it in Query Analyser and remember to set the Results in Text (Ctrl+T) then run it. You can then copy the contents of the results pane to use as the query that will update your data.
Does this help?
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
Thank you Collin,
i am still trying that solution which u can advice to me.
Still i can not solve my trouble but i try and i think i ll do it.
Thanks a lot
|
|
|
|
|
Hai Guys I want to Insert,Update,and Delete records into a single table using views in MS SQL 2000. I read this is possible unsig Visual C++.
Can one help. If not views then how can I retrieve data from more than one table and be able to manipulate it in Visual C++ 6.0.
|
|
|
|
|
Hi,
I have a table on SQL Server where one column allows Null values (docMName) and I'm trying to perform a like query using one parameter. When executed the query fails to include rows with Null values for the docMName column. Is there a way to include these missing rows? Any help would be greatly appreciated.
SELECT docIndex, docLName, docFName, docMName
FROM tblStaffPhysicians
WHERE (docFName + ' ' + docMName + ' ' + docLName LIKE '%' + ? + '%')
-- modified at 18:09 Friday 16th September, 2005
|
|
|
|
|
I'm not really sure why you'd create a search like the this intentionally. It's going to wreak havoc on any indexes the execution planner might have taken advantage of.
Why not just use separate arguments for the first, middle and last names?
SELECT <br />
docIndex, docLName, docFName, docMName<br />
FROM <br />
tblStaffPhysicians<br />
WHERE<br />
(docFName LIKE '%' + ? + '%') AND<br />
((docMName IS NULL) OR (docMName LIKE '%' + ? + '%')) AND<br />
(docLName LIKE '%' + ? + '%')
If there is a compelling reason why the statement must use a single parameter value, there are other ways of approaching this, but since you're concatenating a string with spaces right in the SQL statement, it seems like it would be equally sensible to split the parameter value in code on the location(s) of spaces and provide multiple parameters to the command.
Hope this helps,
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
Thank you for responding to my query. When I setup the stored procedure for the application I was unaware that there would be a Null value issue. This is just one view on the data and the concept here was to provide a single textbox to search. I'd rather rewrite the stored procedure than the application if possible. Thanks again.
|
|
|
|
|
This was the reply I got Tom on the Microsoft SQL Forum and it works like a charm.
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
Toms Code=================================================
SELECT docIndex, docLName, docFName, docMName
FROM tblStaffPhysicians
WHERE (docFName + ' ' + ISNULL(docMName, '') + ' ' + docLName LIKE '%' + ? + '%')
|
|
|
|
|
So, if you have a first name and last name, but no middle name in one of your rows, and a user enters text of the form [first name]<space>[last name], how exactly is that going to work, since you will be comparing against a concatenated string value of [first name]<space>''<space>[last name]?
I would say that the application really does need to change, or you need to make your stored procedure a little smarter about how the comparison string is concatenated (basically, smarter about where to insert spaces).
Good luck,
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
The example you gave did not look like a stored procedure. It looked like a text SQL command. Stored procedures don't use wildcards (?) as parameter tokens.
If you would like to provide the stored procedure source, I will try to help you. I'd prefer to see what you've got versus rewriting something and missing some behavioral nuance.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
Sorry, just got back in town; here is the stored procedure. Looks like you're right, it doesn't pull if I query both a First and Last name.
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE ia.SP_StaffPhysicianSelectCommand
(
@Param2 varchar(35)
)
AS
SET NOCOUNT ON;
SELECT docIndex, docLName, docFName, docMName FROM dbo.tblStaffPhysicians
WHERE (docFName + ' ' + ISNULL (docMName, '') + ' ' + docLName LIKE '%' + @Param2 + '%')
ORDER BY docLName, docFName
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
-- modified at 20:49 Sunday 18th September, 2005
|
|
|
|
|
Something like the following would work while preserving some benefit from any indices on the table columns and avoiding the double-space problem you'll encounter with the short version you're using now.
The procedure below parses the name provided as follows:
1. Everything from the start of the string to the position of the first space is considered the first name.
2. Everything from the position of the first space to the position of the second space is considered the middle name.
3. Everything from the position of the second space to the end of the string is considered the last name.
There are obvious issues with even the long version I'm attaching here. For instance, with names that include spaces (e.g. 'Jack Van Horn'). This name will cause problems with either version of the stored procedure; in the version you're using, if no middle name is stored in the database, you'll get the double-space issue, and in my version, 'Van' will get chosen as the middle name, and 'Horn' as the last which will lead to the same conclusion - possibly no returned records.
I don't know how critical this search mechanism is to your users, but I really would suggest looking at using a different solution for finding these names. One possibility would be to just do away with using the middle name in the search altogether, and having a new (calculated) column in your table representing First + ' ' + Last names, then just search on that, or do an edit distance algorithm or something.
Anyway, here's another way to do it, as promised:
<code>
CREATE PROCEDURE ia.SP_StaffPhysicianSelectCommand
(
@Param2 varchar(35)
)
AS
SET NOCOUNT ON;
-- Declare local variables
declare @firstName nvarchar(35)
declare @middleName nvarchar(35)
declare @lastName nvarchar(35)
declare @count int
declare @pos int
declare @oldPos int
declare @Param2 nvarchar(35)
-- Initialize local variables
set @oldPos = 0
set @count = 0
set @Param2 = 'a c'
-- Parse the name parameter
set @pos = charindex(' ', @Param2)
while (@pos > 0)
begin
set @count = @count + 1
if (@count <= 2)
begin
if (@count = 1)
-- First name
set @firstName = substring(@Param2, @oldPos, @pos - @oldPos)
else
-- Middle name
set @middleName = substring(@Param2, @oldPos, @pos - @oldPos)
end
else if (@count = 3)
begin
-- Last name
set @lastName = right(@Param2, len(@Param2) - @oldPos + 1)
break
end
-- Set a position marker and iterate
set @oldPos = @pos + 1
set @pos = charindex(' ', @Param2, @pos + 1)
-- If there are no further spaces, but the end of the string
-- has not been reached, place the remainder into the next
-- open slot
if (@pos = 0 and @count < 3)
begin
if (@count = 1)
set @middleName = right(@Param2, len(@Param2) - @oldPos + 1)
else
set @lastName = right(@Param2, len(@Param2) - @oldPos + 1)
set @count = @count + 1
end
end
-- Evaluate the count: if only 2 words were found,
-- assume they were a first and last name, adjut the
-- values accordingly
if (@count = 2)
begin
set @lastName = @middleName
set @middleName = null
end
-- Finally, select the matching names
SELECT
docIndex, docLName, docFName, docMName
FROM
dbo.tblStaffPhysicians
WHERE
docFName like '%' + @firstName + '%' AND
((docMName is null and @middleName is null) OR (docMName like '%' + isnull(@middleName, '') + '%')) AND
docLName like '%' + @lastName + '%'
ORDER BY docLName, docFName
</code>
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
The option CONCAT_NULL_YIELDS_NULL controls what happens when you concatenate a NULL with a string. As the name suggests, when you concatenate a NULL with a string and this option is set, the result is NULL.
This option is not set by default in the database, but is set by the ODBC driver and OLE DB provider. I'm guessing it's also set by the ADO.NET provider, although I can't find documentation on this.
So, when you get a NULL in the docMName column, the result of the concatenation is NULL, hence it doesn't match the query. The change you found on the other forum works because it changes a NULL to an empty string with the ISNULL function.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Yes, but I'm not out of the woods yet. When I search on a combined string it (John Smith) it fails to return any rows.
|
|
|
|
|
Ehi guys,
i've tried in the past to make some application in c# that use ADO.NET with Databasa Access.
It is a quite easy stuff, but i know i can use mySQL database too.
I Have no idea in matter, so i don't know if i need during the develope mySQL engine daemon running on my pc and if it is needed also for the final user.
Then i don't know how create a database in this way, connect it to my application and working on.
Finally i don't know how include it in my solution.
Big thanks to everyone can jelp me.
|
|
|
|
|
hi there,
Here are just some articles on CP site:
1. http://www.codeproject.com/dotnet/mysqlconnexion.asp
2. http://www.codeproject.com/cs/database/ConnectMySQL.asp#xx1105859xx
Hope that helps
<< >>
|
|
|
|
|
ok tnx for your indication but is there someone that can contribuite?
|
|
|
|
|
Why don't you use the MySQL Connector for .NET 1.0.5 from MySQL.com ?
|
|
|
|
|
becouse i don't know it and how use.
|
|
|
|
|
Hi,
here is the link: http://dev.mysql.com/downloads/connector/net/1.0.html
Downlaod and install the connector. After finishing the installation, you can use it like any other ADO.NET-Connector.
André
|
|
|
|
|
Hi
The situation i m facing is - i have several databases of lower level shops which needed to be consolidated on regional level, shops' DB will be ported on the regional HQ n on the basis of databases imported, reports will be generated.
Well, do u guys have any experiance of such situation or if you can suggest me some link which describes such situation in form of case study or whatever.
Thanks in advance
Utsav Verma
|
|
|
|
|
|
I have made windows application using .NET 2.0 BETA 2.0(VC#) with MSDE(Release A) as database tool. Now when I install my application on Windows 2000,XP,2003, it works well. But When I install on Windows 98, application is not connecting to database..
On command prompt, using OSQL, I can list database, table and I can connect to database. But When I try to connect throught application using connection string then it does not work.
Please help me sorting out this problem.
Thanks
1) Connection String is same in all O.S. version and it is SQL Auth.
2) I wrote following things in setup.ini of MSDE
[OPTIONS]
SAPWD="NILESH"
INSTANCENAME="NILESH"
SECURITYMODE=SQL
3) In Windows 98, I have used MDAC 2.8
Nilesh Gambhava,
Life is NP-Complete so don't use Algorithm but use Heuristics
|
|
|
|
|
Friends,
I've just installed MSDE in my machine for the first time. What i've seen is that it only installed Server and no client tools, unlike SQL server 2000.
Are there any client tools available for MSDE (like Enterprise Manager or query analyzer of SQL-server 2000). If not, then how can i manipulate the database of MSDE and create or view databases??
Ahsan
|
|
|
|
|