|
Works, Thanks
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
No problem,I am glad that worked for you.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
|
|
|
|
|
I have to be able to select het highest number smaller than a certain number
for example I have in DB
1
2
5
6
7
and I want the highest number smaller than 5 (in this case 2) but can't seem to get this working (at least not in 1 sql statement)
I can get the numbers 1 and 2 (is easy) but want to get only the number 2
any help would be appriciated
|
|
|
|
|
TDDragon wrote: I have to be able to select het highest number smaller than a certain number
for example I have in DB
1
2
5
6
7
and I want the highest number smaller than 5 (in this case 2) but can't seem to get this working (at least not in 1 sql statement)
I can get the numbers 1 and 2 (is easy) but want to get only the number 2
any help would be appriciated
Select Max(ID) where ID<5
Does that work for you?
|
|
|
|
|
I tried this yesterday but it returned an empty row
tried it again today and now I do get an value (think my mind is playing tricks on me )
or the fact that I had a second column in the select statement was cousing trouble I don't know anyway it works now
Thank you for you time
|
|
|
|
|
ChandraRam is correct, but you can use this query too:
select top 1 id from tablename where id < 5 order by id desc
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
|
|
|
|
|
Wonder why I didn't think of that...
|
|
|
|
|
Hi everyone,
I am developing a asp.net c# application. I am a beginner to MSMQ. I need to save the data(username, password) into msmq. In the particular period of time, I need to transfer that data(username, password) to MySQL database due to making the fast data access. How is it possible. Please help me regarding this. The best elaborated answer with some examples would be appreciated.
Thanks in Advance,
J. Mohan.
I see the God Face in Helping people
|
|
|
|
|
i do not how it is in mysql but in MS SQL you can use stored procesure..
if you want to knw abt that tellme...
|
|
|
|
|
I developing a software in which I am listing products.
On product name there is link which shows product details on the basis on product name passed to details page.
Some product contain name with % symbol shows error in details page. Other product details are coming fine.
How to resolve this problem. Please suggest.
|
|
|
|
|
Poonam Devi wrote: Some product contain name with % symbol shows error in details page
What is the error?
|
|
|
|
|
CAn you Explore it more with Code....
I can try on it.....
By
|
|
|
|
|
as far as the backward compatibility is concerned , how can i differentiate the ms access and sql server , on the basis of this feature?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
Sorry, I don't understand your question. What are you trying to find out?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Does any one know how I would get some data from a MsSQL database and upload it to MySQL hosted server
Situation
I’m running Symantec backup exec on a few severs and they email me notifications of what’s happened in the back up but there are too many to start filling away!!! The program uses MsSql to store the information I want to upload it to mysql hosted sever. I can tell backup exec to run a command after backup
any ideas guys
|
|
|
|
|
Have you tried SSIS?
“If we are all in agreement on the decision - then I propose we postpone further discussion of this matter until our next meeting to give ourselves time to develop disagreement and perhaps gain some understanding of what the decision is all about.”-Alfred P. Sloan
|
|
|
|
|
Please tell me how to add a database created in sql server database which is stored in default folder of Microsoft SQL Server to a my folder(created by me)?
|
|
|
|
|
Do you mean you want to move the data files for an existing database to a different location?
Detach the database (right-click it in Management Studio or Enterprise Manager and click Detach), make a note of the security settings on the files, move them, check that the same users have permission to read and write the files, and then re-attach the database (this option is named Attach on the server's context menu).
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
Hi,
How can i configure my Sql Server2005 to communicate with MSAccess which is locating on some other place(Other city). I want to update the Sql server with the updated information of MSAccess tables as they both come online. Please guide me to setup this confuguration.
Thanks in advance
|
|
|
|
|
I have found a potential problem which may get some people stuck when they have customised their Regional Settings. Too short to submit as an Article. Moderators please do with it what is best.
I live in South Africa. PC set up for English (South Africa).
The problem is, Microsoft says that in South Africa we write our dates as MM/dd/yyyy, when in fact we (ordinary people) use dd/MM/yyyy.
So in Reqional Settings we use Customise and change our Short Date format to dd/MM/yyyy.
Everything works fine if you use datasets to update a table, as the data is already a DateTime. But when you use an INSERT INTO command a problem comes up because the DateTime needs to be placed between single-quotes:
"INSERT INTO (column) VALUES('" + myDate + "')"
In our case, this converts to:
"INSERT INTO (column) VALUES('dd/MM/yyyy')"
But the server is expecting:
"INSERT INTO (column) VALUES('MM/dd/yyyy')" because this is the default short-date format for South Africa.
So the following must be used:
"INSERT INTO (column) VALUES('" + myDate.ToString("MM/dd/yyyy") + "')"
This converts to:
"INSERT INTO (column) VALUES('MM/dd/yyyy')" which is what the server is expecting.
This problem will arise with any Customisations made, including separators. myDate.ToString() must specify the exact format the server is expecting.
Nigel
|
|
|
|
|
|
If needing to parse in date information like that (and you can't use parameterized as suggested by the previous poster), use the ISO format and it should be okay on all regional settings.
Of course there'll be problems if the regional settings are different from what you feed any conversion with. How else do you think it should know whether the date 04/05/2008 means either 4th May or 5th April. How else will you know whether numbers use decimal point period or comma etc.
That is the "problem" with conversions between regions.
|
|
|
|
|
Hi,
I have created a "test" table having 4 column Q1,Q2,Q3 and Q4 with values one,two,three,and four respectively. Please refer the code below:-
Declare @loopId int
set @loopId=1
Declare @vr varchar(100)
declare @variable varchar(100)
while @loopId<=4
begin
set @vr='Q'+''+Convert(varchar,@loopId)+''
Select @variable=@vr from test
print(@variable )
set @loopId=@loopId+1
end
In the above code I am printing the values of each column of table "test" one by one.But the out put of the above code is
Q1
Q2
Q3
Q4
but i want to have the values not column name.This is a sample code which I will be using in one of my stored proc.What wrong I am doing.Please help.
|
|
|
|
|
Pranav Thakur wrote: Select @variable=@vr from test
This line holds the problem. You wil need to create a dynamic query to display values.
|
|
|
|
|
hi...
Try This one....
Declare @loopId int
set @loopId=1
Declare @vr varchar(100)
declare @variable varchar(100)
Declare @qry VarChar(1000)
while @loopId<=4
begin
set @vr='Q'+''+Convert(varchar,@loopId)+''
Select @variable=@vr from test
print(@variable )
Set @qry = (Select @variable=@vr from test)
set @loopId=@loopId+1
Exec(@qry)
end
Take Care ....
sure there will not be any prob now if still having prob..then
reply..
take care...
By
|
|
|
|