|
Check datatypes fields in relations tables
I Love SQL
|
|
|
|
|
Thank you for your answer.
However, I am sure I am right unless I don't understand what do you mean.
This is what I have:
I have a table called DHS_CostCenter that has these columns:
1- CostCenterID (Primary Key) int Not Null.
2- CostCenterName varchar(70) Not Null.
The other table called DHS_Employee that has these columns:
1- BadgeNum int Not Null.
2- Name varchar(50) Not Null.
3-CostCenterID int Not Null.
4- DateFrom smalldatetime Not Null.
5- DateTo smalldatetime Not Null.
I made a relationship between them (the primary key is CostCenterID that is in DHS_table and the Foreign Key is in DHS_Employee).
After that when I want to save it, I got this error.
I am looking for an answer.
|
|
|
|
|
Hi CanadianBoy:
When you made a relationship between them (the primary key is CostCenterID that is in DHS_table and the Foreign Key is in DHS_Employee).
You must compare between data PK and FK
i think found data in FK not Found in PK
Example :
Table DHS_CostCenter
----------------------------------------------
CostCenterID CostCenterName
1 'Cost1'
----------------------------------------------
2 'Cost2'
----------------------------------------------
4 'Cost4'
----------------------------------------------
Table DHS_Employee
----------------------------------------------
BadgeNum Name CostCenterID DateFrom DateTo
-----------------------------------------------------------
1 'badge1' 1 1/1/2007 2/2/20007
-----------------------------------------------------------
2 'badge1' 3 1/1/2007 2/2/20007(This Record have problem because CostCenterID 3 not found in table DHS_CostCenter)
----------------------------------------------------------
3 'badge1' 4 1/1/2007 2/2/20007
----------------------------------------------
best regard
Rami Abd Alhalim
|
|
|
|
|
Thanks a lot. That was right. I was looking in each coulmn exept to this coulmn.
Thanks again.
|
|
|
|
|
Hai ALL! My TL used to told me that about to backup our database!
He told me that use business Inteligence Studio(BI) to develop DTS,
But i dont know where it reside? Whether it comes from SQL Server 2005 or .NET 2005!
Please give some information about to backup our database using DTS Concept in SQL Server aslo business Inteligence Studio(BI)! Help me please!
|
|
|
|
|
DTS is called SSIS[^] in Sql Server 2005.
|
|
|
|
|
|
Hi friends
I want to know how to create a job in MSsql.
Thanks in advance
Pathan
---------------------------------------------------
|
|
|
|
|
|
I am using an OLEDB sequential stream to read data from a SQL Server stored procedure that generates XML output using FOR XML. The output is non-terminated double byte character strings preceded by 68 decimal and the length, e.g. 68 02 69 0 100 0 is "Ed". Then the next string starts. What C++ function(s) are used to decode this?
|
|
|
|
|
DECODE in SQL Server
SELECT CASE WHEN Assignment_Type = 'C' THEN 'Com' ELSE 'Donot Know'
FROM ASSIGNMENT
When I try to use CASE WHEN, it gave me error [Microsoft][ODBC SQL Server
Driver][SQL Server]Incorrect syntax near the keyword 'FROM'. What did I do
wrong?
Thanks
"David Portas" <remove_before_replying_dportas@acm.org> wrote in message
news:24GdncWmqJeLKfzcRVn-vg@thehitcounters.com...[color=blue]
> Use CASE
>
> --
> David Portas
> SQL Server MVP
> --
>
>[/color]
http://www.thehitcounters.com
Custom Logo Design Services by http://www.thebusinesslogo.com
modified on Wednesday, May 6, 2009 6:18 AM
|
|
|
|
|
Answer: add TYPE to the SELECT statement. This will return XML format instead of nvarchar. For example,
SELECT Quantity, Price FROM OrderDetails FOR XML AUTO, TYPE
|
|
|
|
|
I need to know ,How i can create publication?
SQL Server 2000
Rami Abd Alhalim
|
|
|
|
|
How can we rollback the operation performed on a table in the trigger code ? And another question : If an error occures in the trigger code will the operation performed on the table be rolled back ?
|
|
|
|
|
you can used begin transaction
Rami Abd Alhalim
|
|
|
|
|
Do anyone have any idea about how to store large amount of text(like codeproject articles) ? One solution would be to store it in a table field with ntext or text type. And the other way may be to store it in text files on hard disk. We also want to be able to search our text data. In the first solution we can do this more easily but in the second one I dont know how we would do it .
I will be waiting for anyone who may have any idea about this issue. Which method would you prefer and why ? And say if you have any other solution . Also say how you would accomplish the search if you were to store text on hard disk ?
|
|
|
|
|
If you want to search it all, then you need to store it in the DB. If you want to search just keywords, you may elect to store it in the file system, and store the keywords with the path.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi all,
I am using ASP.net 1.1 with backend MSSQL.
I have a table Category
Catid Catname
C1 Test1
C2 Test2
I have a Request table
id request categoryid status flag
1 abcd Request C1 0 F
2 xyz request C2 0 F
3 sdf request C1 1 I
4 ab Request C1 1 I
5 prz request C1 1 I
6 frf request C2 1 F
7 frf request C1 1 F
8 frf request C1 1 F
i want show its countlike
CaetgoryName Waiting INCOMING OUTgoing
Test1 1 3 2
TEST 2 1 0 1
waiting means status=0 and flag='O"
INCOMING mean status=1 and flag='I'
outgoing means status=1 and flag='O'
how i make sql query???
is dere any way show this to my webform???
-- modified at 2:39 Saturday 18th August, 2007
All I ever wanted is what others have.... CrazySanker
|
|
|
|
|
Don't cross-post your queries.
Paul
|
|
|
|
|
I got its solution.. but i dodnt know is it a right way or not..
create one UDF Funtion
<br />
<br />
CREATE FUNCTION GetCount (@Request CHAR(1), @CatID VARCHAR(5)) <br />
RETURNS INT AS <br />
BEGIN <br />
<br />
Declare @Count INT<br />
<br />
IF @Request = 'W' --Waiting for approval<br />
SELECT @Count = count(RemitterRefNo) from TblRemittanceTxn<br />
WHERE Category='O' AND status=0 AND Catid=@CatID<br />
<br />
ELSE IF @Request = 'I' ---Incoming <br />
SELECT @Count = count(RemitterRefNo) from TblRemittanceTxn<br />
WHERE Category='I' AND status=1 AND Catid=@CatID<br />
<br />
ELSE IF @Request = 'O' --OutGoing<br />
SELECT @Count = count(RemitterRefNo) from TblRemittanceTxn<br />
WHERE Category='O' AND status=1 AND Catid=@CatID<br />
RETURN @Count<br />
<br />
END<br />
and write a query like this
<br />
Select distinct CatName, <br />
dbo.GetCount('W',catid) as waiting_count,<br />
dbo.GetCount('I',catid) as incoming_count,<br />
dbo.GetCount('O',catid) as outgoing_count<br />
from TblCategory <br />
<br />
All I ever wanted is what others have.... CrazySanker
|
|
|
|
|
|
Don't cross-post your queries.
Paul
|
|
|
|
|
hi
thankyou for your information about my problem that write it in subject in your site
i read it but if it is possible for you please send more explane it for me
i never used this service befor and dont know where and how i can use it.
thank for your help
|
|
|
|
|
I don't really understand what your problem is.
What reporting technology are you using? Or are you taking data directly from the database?
Paul
|
|
|
|
|
i want reporting in web pages with asp.net but if we can taking data or reporting directly from sql server please write for me
thanks for helping
|
|
|
|