|
Hahaha, ok clearly missed that one
Glad it works now.
WM.
What about weapons of mass-construction?
|
|
|
|
|
Hi ,
I want to read the distinct records with multiple columns.
for example,
tableA
--------
OID CODE
1 READ
2 READ
3 WRITE
4 WRITE
select distinct CODE, OID from tableA
it gives,
READ 1
READ 2
WRITE 3
WRITE 4
but expected result was,
READ 1
WRITE 3
|
|
|
|
|
man this sql script is not work like this ....
u should use the group by function to get that effect and any aggr functions
select CODE, min(OID) from tableA
group by CODE
This should fetch you the result
thanks,
SeEa
|
|
|
|
|
hmm not sure exactly what your looking for so I'm going to assume you want:
the lowest OID for each distinct CODE
which is:
select CODE, MIN(OID) from tableA group by CODE
which would give your desired result.
DISTINCT is no way appropriate for what your trying to do in this case!
|
|
|
|
|
don't assume you have OID in number format
OID CODE
x READ
y READ
z WRITE
..
this scenorio
expected result will be,
OID CODE
x READ
z WRITE
|
|
|
|
|
if you didn't want us to assume , then you should have stated clearly in your orig post, instead of wasting our time.................
dunderhead
|
|
|
|
|
In that case also teh above approach of grouping by should work !!!
thanks,
SeEa
|
|
|
|
|
Hi,
I need an suggestion how to run sql server in local. In my system sql server was not running in local, but when I connect to our remote data base with it's IP ,username and password, I can able to connect, but not in the local system sql server.I am using windows XP OS. I tried to register a new connectio to my local but i am getting an error the Acdess denied or connection faild.
Plz any one suggest me how to troubleshoot this problem
Regards
Exelio
|
|
|
|
|
Try the sql authentication method and make sure that the username and the password supplied are correct..
thanks,
SeEa
|
|
|
|
|
Hi, good day.
I have a question about the checkbox in datagrid.
The problem is i have a datagrid in my page and i have 4 checkbox per row in the datagrid. I use the radio button to select the record and i can check the checkbox for certain specify action.
For an example, i select the record to be print in different type of report format. The checkbos is use to select which report format need to be printed out.
Did anyone can help me to solve this problem? Thanks..
-- modified at 22:53 Wednesday 2nd August, 2006
Best Regards,
Pei Sun
|
|
|
|
|
Can anyone tell me what's wrong with this statement (purpose is to update a row if it exists and create it if it doesn't (but that should be obvious)).
IF EXISTS(SELECT * FROM Assemblers WHERE ID = @id)
BEGIN
UPDATE Assemblers SET Name = @name WHERE ID = @id
END
ELSE
BEGIN
INSERT INTO (ID, Name) VALUES (@id, @name)
END
Error is: Incorrect syntax near '('.
Note: I tried writing this on my own, couldn't get it accepted and did a search and someone had posted this code (except for the differing table structures and names) on one of the MSDN forums.
-- modified at 8:39 Wednesday 2nd August, 2006
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
IF EXISTS(SELECT * FROM Assemblers WHERE ID = @id)<br />
<br />
UPDATE Assemblers SET Name = @name WHERE ID = @id<br />
<br />
ELSE<br />
BEGIN<br />
INSERT INTO ????? (ID, Name) VALUES (@id, @name)<br />
END
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
Thank you very much for pointing out the obvious, that was a case of staring at the code for much too long
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
Ed.Poore wrote: that was a case of staring at the code for much too long
We all do that!
Kevin
|
|
|
|
|
what is the major and minor differences between SQL2000 and SQL2005
divya
|
|
|
|
|
SQL 2005 has:
* CLR integeation
* Better XML capabilities
* New T-SQL syntax for pivot tables etc.
There are pages and pages on MSDN about this if you need more info.
|
|
|
|
|
Theres is a new Integration Services which replaces DTS.
DTS is "legacy" and can't be changed unless you install a downloadable tool.
Look where you want to go not where you don't want to crash.
Bikers Bible
|
|
|
|
|
|
It's not very polite to steal someone else's thread.
Please start a new one if you want an answer
WM.
What about weapons of mass-construction?
|
|
|
|
|
Hi,
My is Sql Server2000 dateTime store like this 2006-06-14 12:28:51.983
i m getting this through Store procedure.
i m doing filtering using FromDate to ToDate.
problem is when i m passing same value in FromDate and Todate Like this 2006-06-14 12:28:51 it's not displaying
Help me it's urgent.
-- modified at 6:42 Wednesday 2nd August, 2006
|
|
|
|
|
asif_aslam wrote: My is Sql Server2000 dateTime store like this 2006-06-14 12:28:51.983
Firstly, this is not how SQL Server is storing your date. It is only how it is displaying your date.
asif_aslam wrote: problem is when i m passing same value in FromDate and Todate Like this 2006-06-14 12:28:51 it's not displaying
That is because it is not equal to the date you have in the database. The date you have in the database is 983 milliseconds different to the one you specify.
You may wish to change your ToDate to be one second further on. You may want to use DATEADD(second, 1, @SomeDate) to nudge the ToDate on by one second.
|
|
|
|
|
I have created one new table using datatable.this table does not exist in sql server database.Now when i have created new table,i have created columns and rows and update the values.These values are bound to datagrid and i can see on datagrid.
My question is once i have created this new table,how to update /create this table in sql server.
srkt
|
|
|
|
|
You have to create the table in SQL Server. A DataTable knows nothing of databases, it is disconnected from the database from which its data came (or will be going).
If you are using SQL Server 2000 you can use Enterprise Manager, or you can write some T-SQL to create the table in Query Analyzer. If you are using SQL Server 2005 you can use the SQL Server Management Studio
Once you have the table created in the database you can then use an appropriate DataAdapter (SqlDataAdapter would be best in this case) to transfer information between the DataTable and the actual database.
|
|
|
|
|
hi all i have a sch proj currently that requires me to link up a set of database with a windows form application,that can add,delete, modify the database.. can anyone tell me or show me to some simple articles that does these and provide some sample demo or source codes.. thanks..
|
|
|
|
|