|
Hi Rajesh,
You may want to take a look at the following articles:
http://blogs.wdevs.com/irtaza/archive/2005/02/04/2195.aspx
http://www.sqljunkies.com/Article/6676BEAE-1967-402D-9578-9A1C7FD826E5.scuk
Hope this helps.
Dimple
|
|
|
|
|
hello,
does anybody know how to write a query that returns the maximum value of a column? here is what i have so far:
<br />
SELECT barcode, wellname, well.ph, proteinname, score, time FROM well INNER JOIN welldrop ON well.wellkey=welldrop.wellkey INNER JOIN imageset ON welldrop.dropkey=imageset.dropkey WHERE well.barcode=1111<br />
this query returns several rows for each "wellkey". i only want to return one row for each wellkey, with the most recent date (found in the time field of the imageset table). i tried using MAX(time), but i got an error...
thanks!
RC
-- modified at 17:20 Wednesday 28th June, 2006
|
|
|
|
|
i think i figured it out. the following serves my purposes:
SELECT barcode, wellname, well.ph, proteinname, score, MAX(time) AS time FROM well INNER JOIN welldrop ON well.wellkey=welldrop.wellkey INNER JOIN imageset ON welldrop.dropkey=imageset.dropkey WHERE well.barcode=1111 GROUP BY barcode,wellname
|
|
|
|
|
This question requires experience with Visual Studio .NET 2005.
I created an n-tiered application and in the Data Access Layer I used a direct connection to the Database by specifying the server, username, password, etc in the connection string. Now I want to change this so that the application connects to the Database through a DSN defined on the local machine that connects to the server.
So I went ahead and changed the connection settings to point to a dsn. The connectio string looks like this after the change:
Dsn=dsnname
But I get an error when the connection is initialized at run time telling me that 'dsn' is not a recognized string in the connection string. Please remember that in both cases I did not generate the connection string manually, VS did it for me.
Any help will be appreciated.
|
|
|
|
|
|
Yes, I did figure it out a few hours ago. The DAL was created using a SqlConnection and since a DSN will utilize an OdbcConnection, the SqlConnection object that was created as part of the project did not recognize it. Since I used a visual editor to change from a SqlConnection to a OdbcConnection, I figured VS.NET will do the work for me. Apparently it doesn't. Thanks for your help.
|
|
|
|
|
I'm trying to find a way to grab a given rows cell information, for now just the primary key, and store it in a variable to use somewhere else. If I use listbox's I can simply use .selectedValue() and it gives me exactly what I need, but in this case, I'm needing to do it with a datagridview and this attribute doesn't exist. Thanks!
|
|
|
|
|
Hi Champs
I am writing DTS first time so need little help.
I need to check 2 columns (Col A and Col B) of Table A .
If there is no entry for these columns for current date then i need to send mails to some recipients same day at 12:00 PM.
*** Can i get the query help *** and any link where i can understand this functionality
Thanks A Lot !!!
|
|
|
|
|
Hi - We have a bunch of tables in our database but no schema was created. Is there a way we could created the schema using the existing tables automatically in SQL2005, just a basic version - or we just have to create it manually?
Is there a feature in 2005 that would do this?
Many thanks.
Vani
|
|
|
|
|
|
the database diagram which shows all the relationships between the tables.
-- modified at 7:22 Thursday 29th June, 2006
Like reverse engineer the tables and create the schema since one was not created while the tables were designed.
thanks,
vani
|
|
|
|
|
|
You can use the "Database Diagram" to create the schema.
thanks for your time.
|
|
|
|
|
|
Expand the node for the database, click Database Diagrams. If you haven't created one before, Management Studio will prompt you to to create the support objects required for diagramming. Right-click Database Diagrams and choose New Database Diagram. From here, select the tables you want in the diagram and click Add. Click Close when you've finished adding tables to the diagram.
Management Studio now arranges the tables so that the key relationships don't cross each other.
Note that key relationships are only shown where you've actually defined a FOREIGN KEY relation between tables. They're normally shown as one-to-many, unless the relationship is between the primary keys at both ends, in which case they're shown as one-to-one.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hello,
Do any body have idea of getting complete database backup of mySQL database except this?
SELECT * INTO OUTFILE Path FROM Table
I want just there should be only one backup file of All tables and how to restore that. I am using:
mySQL 4.1 and VB 6.0.
Thanks
|
|
|
|
|
use MYSQLDUMP
a built in function for backup all database in mysql.
more information:
http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html
|
|
|
|
|
thanks for ur response!!!
can u please tell me how it can be used in VB 6.0. I have treid but its giving error?
|
|
|
|
|
Hi
you must use it with SHELL commands
i don't know what is this command in VB exactly.but you can search in MSDN for shell.
shell commands are Command Prompt console for executing commands.
i searched for you and i found these:
http://experts.about.com/q/Visual-Basic-1048/using-Windows-Shell-VB6.htm
|
|
|
|
|
Why dont you try using MySQL Administrator utility? Its a a free utility available on www.mysql.com. It can perform backups and restores from a graphical interface, and also schedule backups.
"MySQL Administrator is a program for performing administrative operations, such as configuring, monitoring and starting and stopping a MySQL server, managing users and connections, performing backups, and a number of other administrative tasks."
Thanks and Regards,
Aby
|
|
|
|
|
Thanks for your suggestion, actually as i mentioned i am using VB 6.0 as front end and mySQL 4.1 as back end. i want there should be an option for taking the backup of complete database from VB form:
user just tell the path where he wants to take backup of database.
any suggestions?
Thanks and Regards,
Javed
|
|
|
|
|
Hi every body,
i got the java code for generation of some code based on 2 inputs..i need to
convert into sql server function..?? i was tried but getting some syntax errors..pls have a look below...and thanks in advnace..
------------------------------------------------------------------------------
CREATE FUNCTION getGridNum (@ref1 bigint,@ref2 bigint)
RETURNS bigint AS
BEGIN
declare @gridA bigint
DECLARE @gridB bigint
DECLARE @osGridNum1 bigint
DECLARE @osGridNum2 bigint
DECLARE @osGridReference bigint
--@osGridNum1 = @REF1 -- for use later to get number section of the grid ref
--@osGridNum2 = @REF2 -- for use later to get number section of the grid ref
/*get the first number of the number of the
grid reference and concat '00000' so it can be c
compared in the lookup table - unless it is '0'*/
--if (gridA.length < 5)
if len(@REF1)<5
begin
-- @REF1 ='0' + @REF1
@REF1 = '0' + CAST(@REF1 AS VARCHAR(10))
--- gridA = @REF1.substring(0,1)
@REF1 = substring(@REF1,0,1)
end
else
begin
if (gridA != '0')
gridA = gridA + '00000'
end
/*get the second number of the number of the
grid reference and concat '00000' so it can be c
compared in the lookup table - unless it is '0'*/
-- if (gridB.length < 5)
if len(gridB)<5
begin
gridB ='0' + gridB
-- gridB = gridB.substring(0,1)
gridB = substring(gridB,0,1)
end
else
begin
if (gridB != '0')
gridB = gridB + '00000'
end
-- send substringed letter to searchLetter function to find the corresponding OS grid letters
oSgridLetter = searchLetters(gridA, gridB)
/*The next if statements take the oringinal numbers and substring them to get
valid numbers for the OS grid format. Of five numbers it is the middle 3*/
--if (osGridNum1.length < 5)
if len(osGridNum1) < 5
begin
osGridNum1 = '0' + osGridNum1
-- osGridNum1 = osGridNum1.substring(1,4)
osGridNum1 = Substring(osGridNum1,1,4)
end
--if (osGridNum2.length < 5)
if len(osGridNum2) < 5
osGridNum2 = '0' + osGridNum2
-- osGridNum2 = osGridNum2.substring(1,4)
osGridNum2 = substring(osGridNum2,1,4)
-- Now concatinate the Letters and the the OS letters and the two sets of os grid numbers together to get the correct formate
osGridReference = oSgridLetter + osGridNum1 + osGridNum2
return osGridReference
end
END
----------------------------------------------------------------------
Server: Msg 170, Level 15, State 1, Procedure getGridNum, Line 26
Line 26: Incorrect syntax near '@REF1'.
Server: Msg 170, Level 15, State 1, Procedure getGridNum, Line 33
Line 33: Incorrect syntax near 'gridA'.
Server: Msg 170, Level 15, State 1, Procedure getGridNum, Line 44
Line 44: Incorrect syntax near 'gridB'.
Server: Msg 170, Level 15, State 1, Procedure getGridNum, Line 53
Line 53: Incorrect syntax near 'gridB'.
Server: Msg 170, Level 15, State 1, Procedure getGridNum, Line 69
Line 69: Incorrect syntax near 'osGridNum1'.
Server: Msg 170, Level 15, State 1, Procedure getGridNum, Line 77
Line 77: Incorrect syntax near 'osGridNum2'.
|
|
|
|
|
I can see you've just not translated some Java properly. You should also be aware that Java and SQL are different language types. Java is procedural (i.e. you specify the procedure you want it to take) where as SQL is, for the most part, declarative (i.e. you specify what you want and it figures out the details) - but SQL can also operate in a procedural way also but that is often very inefficient. The procedural elements exist only to suppliment the declarative (set based) elements. If you can use a set based operation then SQL is very efficient.
What you are doing here is imposing a procedural model.
GBal wrote: @REF1 = '0' + CAST(@REF1 AS VARCHAR(10))
Should be
SET @REF1 ...
GBal wrote: if (gridA != '0')
!= in Jave is <> in SQL
Scottish Developers events:
* .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy
* Developer Day Scotland: are you interested in speaking or attending?
My: Website | Blog
|
|
|
|
|
Hi Colin,,Thanks for ur reply..i was changed that function..But here im getting another java code function and i need to translate it into SQL server again..im confused with the for loop in the below code..pls help me..
/* Function will take grid numbers and use lookup array to match the correct OS grid letters */
CREATE FUNCTION searchLetters (let1 bigint,let2 bigint)
RETURNS bigint AS
BEGIN
DECLARE @LEN BIGINT
SET @LEN = LEN(OSgrid)
for (var i=0; i
|
|
|
|
|