|
you din understand my question and now making fun of me.'minimum of top 2' means the lesser of the top 2 that is the second largest salary.Now if you are too smart tell this eddyvluggen.
|
|
|
|
|
joindotnet wrote: making fun of me
I was, wasn't I?
joindotnet wrote:
What wud be the qeury???
You just wanted someone to write a query for you, and someone did. Have you actually tried writing the query? If so, why didn't you post the piece that you already wrote?
|
|
|
|
|
I can write the queries by myself. I just wanted to know whether there is a simplification for it
select min(salary) from (select top 2 salary from order by salary desc)
By the way this place is for professionals not for people like u who r here to have fun.
|
|
|
|
|
I didn't know professionals could not have fun. If you ask an oversimple question or break the forum guidelines, you will get flamed.
Blog link to be reinstated at a later date.
|
|
|
|
|
I need to copy rows from datatable to database by using SQLBulkCopy. I am using ODBC connection. How can I use ODBC connection with SQLBulkCopy.
|
|
|
|
|
SQLBulkCopy is a class that is used with native SQL Server connection (SQLConnection). It cannot be used with ODBC connection. If you're using Microsoft ODBC driver for SQL Server, it has enhancements that make it possible to use bulk copy operations, but then the functionality is the same as in bcp, not the same what is defined for SQLBulkCopy.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Hi..
My function is to extract only number from given string.
i m using mysql database and i m new to the syntax.
is there anyone help me pls?
thanks in advance!
=====================
BEGIN
DECLARE @Count INT
DECLARE @IntNumbers VARCHAR(1000)
SET @Count = 0
SET @IntNumbers = ''
WHILE @Count <= LEN(@String)
BEGIN
IF SUBSTRING(@String,@Count,1) >= '0'
AND SUBSTRING(@String,@Count,1) <= '9'
BEGIN
SET @IntNumbers = @IntNumbers + SUBSTRING(@String,@Count,1)
END
SET @Count = @Count + 1
END
RETURN @IntNumbers
=============================================
The following error Message is shown.
Script line: 4 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@locator VARCHAR(20))
RETURNS INT
AS
BEGIN
DECLARE @cnt INT
DECLARE' at line 1
|
|
|
|
|
|
thanks.
i referenced this function.
and it shown the error as i mentioned.
|
|
|
|
|
It's working in SQL Server dude. Since you are trying to execute it on MySql, you probably have to find which line should be replaced with the proper corresponding sql syntax in MySql.
_
|
|
|
|
|
Background:
I've been requested to make an app that keeps track of complaint files that come in. These are non-standard and come in the form of PDF, doc, txt and xls. What needs to be tracked would be things like PO, Employee, Customer, etc. There can be multiple values to each of these or no value at all.
Problem:
Since I don't want to try to read from all of these files, I figure a categorized tagging system through SQL server might work. I'm somewhat reluctant to develop such a system, however, due to performance reasons.
Possible solutions:
The first solution I had in mind is using 3 tables. One table contains the file information. Another table contains the tag names. The third table relates to the file and tagname tables and holds the values of a tag associated with a file. I was thinking I could just index the column containing the tag values and query through it.
The second solution involves one table containing the file name, delimited string of tag names and a delimited string of tag values.
Issues:
I'm not sure how costly the first solution will be on the server. I'm not wanting full text indexing, just an index on one varchar(30-ish) column.
The second solution would be pretty simple to use regular expressions in my front-end to search through the values. But I wouldn't want to query against this since string comparisons are costly enough when they're straight 1-1.
Which of these would be the better way to go? Would I absolutely be raping my server if I implementing my first solution?
Any input is appreciated.
|
|
|
|
|
The first one is definitely better.
You have far more options to tune the statements if you encounter bottlenecks when you have done database modelling as it should be done. The second one leads to several problems. Slow queries, poor maintainability, non-efficient indexing etc.
Just to throw another possibility, you could also consider xml-field on the same table as document names. It can be easily updated, using at client side is typically very straightforward and also it can be indexed.
Hope this helps,
Mika
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Awesome.
Thanks for the input.
|
|
|
|
|
You're welcome
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Most definately agree with Mika, option 1 is the way to go. As for performance, it shouldn't be a big problem unless you expect hundreds of millions of records - in which case you may want to look at partitioned tables.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Good point
Mika
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
I'm trying to group almost-duplicate contacts in our database.
ie. ABC Corp, ABC Corp., ABC Corp.
The SOUNDEX function only returns a 4-character result. Many of our names are clearly NOT identical, yet return the same result.
Is there a better function I could use?
Cheetah. Ferret. Gonads. What more can I say? - Pete O'Hanlon
|
|
|
|
|
This depends what you are trying to achieve with soundex. If I remember correctly, soundex was created for immigration officers to search for potential names that sound the same, so it's not meant to be an exact match. The algorithm is very simple and you can extend it. However then it may not be as efficient anymore if used for original purpose.
Mika
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Here's a sample output of name with Soundex. The name has spaces stripped out.
There are too many A345.
I looked up the algorithms, and will use D-M I guess.
ATLANTICSHOPPINGCENTRE: A345
ATLANTICSHOPPINGCENTRES: A345
AtlanticPeoplesHousing: A345
ATLANTICSHOPPINGCENTRESLTD: A345
AtlanticBapt.Sr.Citizens: A345
Atlas-AxisLtd.: A342
AtlanticShoppingCentres: A345
ATLANTICSHOP.CENTRE/NEWCO: A345
AtlanticGreatDaneLtd.: A345
AtlanticWholesalers: A345
ATLANTICSHOP.CENTRES: A345
ATL.SHOP.%MELANSONDISPLAY: A342
ATLANTICBALLETTHEATRECOMPAN: A345
ATLANTICWAFFLESLTD.: A345
ATLANTICSAVEEASY: A345
ATLANTICBAPTISTUNIVERSITY: A345
ATLANTICCOMMERCIALPROP.: A345
ATL.SUPERSTORE/A.JEANSSIGNS: A342
AtlanticShoppingCenters: A345
ATLANTICREMANLTD.: A345
AtlanticPeoplesHousingLtd: A345
AtlasColdStorageLtd.: A342
AtlanticUndergroundServices: A345
AtlanticChoiceProperties: A345
Cheetah. Ferret. Gonads. What more can I say? - Pete O'Hanlon
|
|
|
|
|
That sounds fine.
Just a thought: If you're looking for quite exact matches, would it be easiest to create your own function and simply remove (for example using replace) all non-wanted characters like: '[space]%-.: etc. After that convert the string to lower case and using collations strip away accents and so on.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
I'm already stripping punctuation and blanks.
Yes I think I have to write my own.
Even D-M only gives 6 digits, so it fails to differentiate my long strings.
Cheetah. Ferret. Gonads. What more can I say? - Pete O'Hanlon
|
|
|
|
|
Just a thought...
If you can afford to let this run as a batch update, maybe you can implement a Levenshtein distance algorithm and decide which records are dupes based on the distance.
|
|
|
|
|
I have created some packages which are using the same sharepoint file. So, when I try to run the jobs (having those packages independently) in parallel, I am not able to execute those. It shows an error stating that failed to acquire connection manager.
What I feel is that as the packages are sharing the same file, those are not able to share the files properly and so the packages are not able to connect to the file.
I just want to know if anyone of you know any changes that I need to make in the sharepoint file properties, in the package properties or in the job properties.
Thank you.
|
|
|
|
|
Dear all,
i am using sql server 2005 , ssrs2005.
i have to generate a report(delivery challan ) where if articles is issued against sample request then one should display as back ground "sample request not for sale" behind the article details
Please help
imran khan
|
|
|
|
|
Hey guys
i need to create a new database using embedded fire bird, at the moment ive got this...
private void btnCreateDatabase_Click(object sender, EventArgs e)
{
if (FieldsValidated())
{
try
{
string fbConnectionString = string.Format("ServerType=1; Dialect=3; User={0}; Password={1}; Database={2};",
txtUserName.Text, txtPassword.Text, txtDbName.Text);
FbConnection.CreateDatabase(fbConnectionString);
DatabaseCreated(this, new CreateFirebirdDbEventArgs(fbConnectionString));
}
catch (FbException ex)
{
MessageBox.Show("btnCreateDatabase_Click - FbException" + Environment.NewLine + ex.ToString());
}
catch (Exception ex)
{
MessageBox.Show("btnCreateDatabase_Click - Exception" + Environment.NewLine + ex.ToString());
}
finally
{
this.Dispose();
}
}
}
... this creates the file just fine, but how do i create the tables in that db?
Thanks
<edit>
I came across a FbBatchExecution object which seems to do the trick
</edit>
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
modified on Wednesday, October 29, 2008 6:31 AM
|
|
|
|