|
how to select a singe qutoes value
eg:
SELECT fBrID,fDocNo,fIntDocNo,fDate FROM tblFinTrans WHERE fNote=erer'l
|
|
|
|
|
Not sure if there is a better way to do this, but I tried the following one and it worked.(Assuming that you are using the query inside a stored proc)
SELECT fBrID,fDocNo,fIntDocNo,fDate FROM tblFinTrans
WHERE fNote = 'erer'+<code>''''</code> + 'l'
Just in case there were two single quotes, then
SELECT fBrID,fDocNo,fIntDocNo,fDate FROM tblFinTrans
WHERE fNote = 'erer'+ <code>''''''</code> + 'l'
|
|
|
|
|
How to discover the foreign key information when using the new GetSchema command on the Connection object? I do get FK info, but cannot figure out how the tables and fields in this FK are related. For SQL2005 I get a FK name but not related table and field. Pls help.
Or could you give me the SQL query for the problem above?
|
|
|
|
|
Huh?
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
Is there a simple, ADO.NET native, way of obtaining a tables metadata without querying data from it?
-----
You seem eager to impose your preference of preventing others from imposing their preferences on others. -- Red Stateler, Master of Circular Reasoning and other fallacies
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
God is the only being who, to rule, does not need to exist. -- Charles Baudelaire
|
|
|
|
|
Le Centriste wrote: Is there a simple, ADO.NET native, way of obtaining a tables metadata without querying data from it?
A quick Google search[^] should provide you with the information you need.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
|
I have 2 tables Earnings and Payroll with ID as primary key and used in payroll as EarnID.
Now how to show the data in tabulated form i.e. is there a way to show
data as shown below as a view?
USERID | BASIC | HRA | DA | TRAV | BONUS
1 | 5000 | 800 | 200 | 0 | 500
2 | 8000 | 1200| 200 |400| 0
TABLES
Earnings
ID | DESC
_______________
1 | BASIC
2 | HRA
3 | DA
4 | TRAV
5 | BONUS
Payroll
UserID | EarnID | Amount
______________________________
1 | 1 | 5000
1 | 2 | 800
1 | 3 | 200
1 | 4 | 0
1 | 5 | 500
2 | 1 | 8000
2 | 2 | 1200
2 | 3 | 200
2 | 4 | 400
2 | 5 | 0
Thank you,
Prashant Koli
|
|
|
|
|
If you are using SQL Server 2005, look at the PIVOT[^] command.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
pmarfleet wrote: PIVOT[^]
Your link just points to a Page Not Found...
Never mind, it worked the second time
Last modified: after originally posted --
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
Paul Conrad wrote: Never mind, it worked the second time
Can I file that one as a PEBKAC 404 error?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
I guess so. It's weird that it didn't work the first time, but now it works
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
i have table named emp
where the coloumns are A AND B.
The date in my table emp are
A B
----------
12 0
13 0
0 17
9 0
0 11
0 8
76 0
NOW I want to count the total no of records IN THE TABLE ,no of records (where A !=0 AND B=0 it means value of coloumn A not
equal to '0' and value of cpoloumn B equal to zero)
AND NO OF RECORDS (where A =0 AND B!=0)
thanks in advance
|
|
|
|
|
Assuming that you are working with Sql Server:
biswa47 wrote: (where A !=0 AND B=0
The outer query fetches the number of rows in A that are not equal to zero and the inner query fetches the number of rows in B that are equal to Zero.
Select Count(*) [A Not Eq 0],
(Select Count(*) From Emp Where B = 0 ) As [B Eq 0]
From Emp Where A <> 0
The same works the other way around, you'll have to change the operator.
biswa47 wrote: where A =0 AND B!=0)
Select Count(*) [A Eq 0],
(Select Count(*) From Emp Where B <> 0 ) As [B Not Eq 0]
From Emp Where A = 0
modified on Wednesday, January 16, 2008 10:31:11 AM
|
|
|
|
|
Hi Guys
I am sitting with a problem where we have a table in a database that must be replicated. This is the easy part. The problem is they only want inserts and updates to replicate and not deletes. Can anyone tell me if this is possible please?
Kind Regards,
Elizma
|
|
|
|
|
How about creating an application to replicate excluding the deleted condition alone
Sathy
|
|
|
|
|
Would have love to, but that is not the requirement. They want a database with that table on the server. They want to make use of SQL replication (mirroring), but only replicate the Inserts and Updates. The problem with normal Mirroring is that the table will look identical. We dont want to make it look identical.
|
|
|
|
|
Well, as I understand replication; that isn't going to happen.
However, you COULD create triggers on the source tables for insert and update to move the data to a table that IS replicated.
For example, we have a table that is replicated; on inserts and updates, a trigger fires writing data to another table in another database.
This process would work in reverse.
Not exactly pretty, but it might work...
Tim
|
|
|
|
|
Hi There.
Thank you so much for your reply. This was eventually the solution that I also came up with. What I've been told is that in SQL 2000 replication of Iserts and Updates alone cant be done, but it can be done in SQL 2005 by editing the Replication Log file and deleting the delete section. (Well, so I've been told).
Unfortunately we user SQL 2000. Triggers will have to do. Thanx again for your reply.
Kind Regards,
Elizma
|
|
|
|
|
Hai to all How to convert datetime column from database to display on the form as dd/mm/yy???
For display purpose i want.
For example my code is---
cmddisplay = New SqlCommand("Select * from Employee", Conn)
Conn.Open()
sqldr = cmddisplay.ExecuteReader()
Try
If sqldr.HasRows Then
While sqldr.Read()
If IsDBNull(sqldr("dob")) Then
Txtdb.Text = ""
Else
Txtdb.text = sqldr("dob")
End If
end while
end if
end try
Here in the txtdb.text column i want to display in my converted format.
Please help me
Thanks in advance
kissy
|
|
|
|
|
Hi
What I normally do is to convert the value to a Date Object first. Then I call the .ToString("dd/MM/yy") in this Method.
E.g.
Label1.Text = Convert.ToDateTime(Date.Today).ToString("dd MMM yy")
Kind Regards,
Elizma
|
|
|
|
|
Thanks for ur reply.
Its is working in my problem also.
Thanks once again
kissy
|
|
|
|
|
I want an output of 2nd highest salary without using a subquery in sql server 2005.I'm writting the following query:
select empno, ename, job, sal, deptno
from (select t.*, row_number() over(order by t.sal desc) seq from emp t) y
where y.seq = 2
But when I run this query, I get an error:
'ROW_NUMBER' is not a recognized function name.
|
|
|
|
|
Using "urgent" in a subject line or forum post is considered rude.
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
In some cases.....Very rude!!
Particularly if it sounds like homework!!!
Do rate the reply, if it helps or even if it doesnot, because it helps the members to know, what solved the issue. Thanks.
|
|
|
|