|
It's not the insert that gets truncated, it's the select from the table.
In Query Analyser set the following option:
Tools->Options->Results->Maximum Characters Per Column=8000
By the way, you can see how much data is in the column by using the datalength() function.
|
|
|
|
|
Hi friends
This is my first post in the Forum.
How Can I Join more than two tables in SQL.
|
|
|
|
|
JawedVikia80 wrote:
How Can I Join more than two tables in SQL.
Same way as you join two tables, just keep using joins until you've joined all the tables you need.
For Example:
SELECT TableA.ID as AID, TableB.ID as BID, TableC.ID as CID
FROM TableA
INNER JOIN TableB ON TableA.ID = TableB.AID
INNER JOIN TableC ON TableB.ID = TableC.BID
This example supposes there are one-to-many relationships between TableA & TableB and also between TableB & TableC. And that TableB has a foreign key to tableA called AID, and also TableC has a foreign key to TableB called BID
Does this help?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
My Blog
|
|
|
|
|
Dear Friend There are many types of the Joins. which type of the join u want to use??
1-Inner join
2-Outer join
3-Self Join
You have example of inner join by our one friend if u need other 2's then reply..
Raj Khatri
|
|
|
|
|
Hi
Please dont get upset if u see this message in two places,
As it is bit urgent i have posted at two place one is at c# forums and another is at this place
How can i handle concurrency in DotNet?
I need to update a record into a database table, by the time I will access the record there is a chance that somebody can change the record.
I know this kind of problem is common.
But never i had an oppurtunity to work this kind of problem.
please let me know the solution.
|
|
|
|
|
Do a search in SQL Books Online for "transactions". More specifically:
begin transaction
commit transaction
and
rollback transaction
|
|
|
|
|
Also, assuming that you're using SQL Server 2000 (or MSDE) have a look at:
sp_getapplock
sp_releaseapplock
In most of the situations where our OLTP system has concurrency issues, I've found app locks to be infinitely more useful than transactions. Transactions (IMHO) should be used for atomicity, not for concurrency issues.
Grim (aka Toby) MCDBA, MCSD, MCP+SB
|
|
|
|
|
This will work.....
But i am using Oracle and also i want to handle this at BLL but not in database.
|
|
|
|
|
Couple of Query questions:
1. is there a way to step through a query and view variables in the Anaylzer for MS SQL Server ?
2. I'm attempting to create a query that will be run dailly for the previous day's infomation, I'm having trouble getting the previous date in a usable format.
The following uis what i have so far:
DECLARE @Year int
DECLARE @Month int
DECLARE @Day int
DECLARE @FullDate varchar(10)
DECLARE @Yesterday datetime
SET @Yesterday=DATEADD(day,-1,GETDATE())
SET @Year = CAST(DATEPART(yyyy,@Yesterday) as varchar(4))
SET @Month = CAST(DATEPART(mm,@Yesterday) as varchar(2))
SET @Day = CAST(DATEPART(dd,@Yesterday) as varchar(2))
SET @FullDate=@Year+'-'+@Month+'-'+@Day
SELECT * FROM Document WHERE (ProcessDate=@FullDate)
Can someone point out where I'm going wrong ?
|
|
|
|
|
Couple of Answers:
1) Create a stored proc and debug it. You debug buy r-clicking on the stored proc in anaylzer and chosing debug. Just destroy the SP if you don't need it.
2) I believe that creating dates from strings is dependent upon SQL Server localization settings. What I answer here may not work exactly the same on your setup.
I have created a UDF to handle the removal (set to 12am) of time information from a DATETIME. \
CREATE FUNCTION DateOnly
(
@Test_DT DATETIME
)
RETURNS DATETIME
AS
BEGIN
DECLARE @tmp DATETIME
SET @tmp = CAST(CONVERT(VARCHAR(20),@Test_DT,101) AS DATETIME)
RETURN @tmp
END
Given this function installed in your database, your query would look like this:
DECLARE @Yesterday DATETIME
SET @Yesterday = DATEADD(d,-1,dbo.DateOnly(GETDATE()))
SELECT * FROM Document WHERE ProcessDate = @Yeseterday
My SQL installation is set for American style dates. This may not work unchanged in your system. Check out the options in the CONVERT() function in Books-On-Line for what will work best in your locality.
|
|
|
|
|
Hi,
I have a problem. I try to load a table into a DataSet. The problem is that the rows that are recieved in the DataSet are duplicated. Say we have 3 records (1,2,3), I get in the DataSet 6 (1,2,3,1,2,3).
When I read using a DataReader the amount recieved is just fine.
Does anybody know what the problem may be?
Here is the code:
OleDbCommand commandNeType = new OleDbCommand("SELECT * FROM NeTypes WHERE Index = ?", m_connection);
commandNeType .Parameters.Add(new OleDbParameter(DB_NeTypes.FLD_INDEX, OleDbType.Integer, 0));
commandNeType .Parameters[DB_NeTypes.FLD_INDEX].Value = index;
OleDbDataAdapter daNeType = new OleDbDataAdapter(commandNeType);
try
{
daNeType.Fill(m_ne, TBL_NETYPES);
}
catch (Exception e)
{
closeConnection(ref m_connection);
return (int)ERR_DB.FILL_DATASET;
}
// create table
DataTable tableNeType = new DataTable();
tableNeType = m_ne.Tables[TBL_NETYPES];
now this: tableNeType.Rows.Count returns twice the amount of actual rows.
Thank you!
|
|
|
|
|
I dont think u will get double the amount..just try out...there is no way u can receive double the amount.
|
|
|
|
|
This should be a simple answer for most people, but its stumping me.
I need to query a table for all records that are between two dates, but my query staement return no values, can someone tell me whats wrong ?
SELECT * FROM MyTable WHERE (WorkValue=15 AND (ProcessDate>'5/19/2004' AND ProcessDate<'6/16/2004'))
|
|
|
|
|
I always put the dates in in ISO format. e.g. '2004-05-19'
Also, have you checked there is actually data for that date range with WorkValue=15
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
My Blog
|
|
|
|
|
Yes, I have also tried
SELECT * FROM Document WHERE (ProcessDate>'20040519' AND ProcessDate<'20040616') ORDER BY ProcessDate
and Yes there are plenty of records that fall within the requested date range.
|
|
|
|
|
Try SET DATEFORMAT ymd first. The US English default is MDY, i.e. '04/19/2004'; yours may be different though.
|
|
|
|
|
You may need to use the CONVERT function. I.e. your SQL server is not understanding the date you submit in the query.
|
|
|
|
|
Steven Campbell wrote:
Try SET DATEFORMAT ymd first.
That won't make any difference. SQL Server always understands yyyymmdd date formatted strings, because that's the ISO standard. (Format 112 in a CONVERT statement.) Likewise, SQL Server always understands yyyy-mm-dd because that's the ISO8601/ODBC standard.
My question to Guinness is, whether that's the EXACT query you're using in query analyzer, or is it version that's been simplified for our benefit?
Grim (aka Toby) MCDBA, MCSD, MCP+SB
|
|
|
|
|
I recving error .
No Clomns were bound prior calling go SQLFetchscroll/SQLExtrendedFetch ..
wt it measn n who it should b handled ,, steps?
thanx
|
|
|
|
|
Please help me in the coding to solve this problem if you know it.
I create a frmCustomer that contains of txtCustID, txtCustFName,txtCustLName,txtCustDob and txtCustIC.... and the Add button, Search button and Exit button. When the user click on the Search button, the frmSearch will show. The user can search for the customer by select the alphabet in a combobox. The details of the customer whose last name start with that alphabet will display in the datagrid.
The datagrid in ths frmSearch contains of CustID, CustName, CustDoB. When the user double click on the specific row of the datagrid. It will retrieve the records from the Customer table in SQL server by passing the CustID and display the CustID, CustFName, CustLName, CustDob, CustIC.... to the txtCustID, txtCustFName,txtCustLName,txtCustDob and txtCustIC....on the frmCustmer. Then, the user can do the edit or delete of the record by pressing the button.
Please help.
Thanks and Best regards,
Vivian;)
|
|
|
|
|
I'm need to run a query from ACCESS 2000 that will extract data from a progress server and dump it into an ACCESS database. I have to specify the fields that I want to extract and I was already able to do so.
The problem was, there is this field TAX_due that is giving me the *hit. ACCESS gives an error message ' Scaling of Decimal Values Resulted in Data Truncation and then the query would stop.
how can I just trucate and ignore the loss data and go ahead anyway? I just aquire about 30 records then it kaboofs because of this error.
anyone, help plz.
TY!
|
|
|
|
|
Hi,
I'm making an OleDbConnection using the Sybase ASE OLE DB Provider with the following code:
_____________________________________________________________________
OleDbConnection oDbConn = new OleDbConnection(sConnectionString);
OleDbCommand oCmd = new OleDbCommand("SELECT * from master.table;", oDbConn);
OleDbDataAdapter oData = new OleDbDataAdapter(oCmd.CommandText, oConn);
DataTable oTable = new DataTable("master.table");
oData.Fill(oTable);
__________________________________________________________________
The database I'm connecting to -requires- a semi-colon at the end of the SELECT command. I've tried ending my SELECT with a semi-colon (see above) but one of my OleDb objects is removing it before it is sent to the database as I can see the following databas error when running my program:
SQL Parser: parse error at line 1.
Command: SELECT * from master.table
Issued by:
How do I control the SQL statements sent to the database via the OleDbConnection so I can add a semi-colon to my SELECTs??
TIA,
Matt
|
|
|
|
|
could you explain why you need a ';'
and also see if you can use a stored procedure to achieve the same.
Bhaskara
|
|
|
|
|
I'm sure we'll be more likely to help with your homework if you first learn how to type. Actually, on second thoughts, we probably won't. Do your own homework, and let us know when you get stuck. Once it looks like you've made some effort, I'm sure many people will be glad to help you if you get stuck.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
wgdesigner wrote:
I think u don't have any knowledge
Well, for starters, I can spell. That puts me ahead of you. And I could care less what you think. Who the hell are you ?
wgdesigner wrote:
and u don't want help anybody without ur profit...
You're right. That's why I was reading the questions forum in the first place, why I write articles here, and why I suggested that I'd be happy to help you if you were willing first to try and do your own homework. Idiot.
wgdesigner wrote:
By the way if u don't want to help then it is not matter but don't try to be oversmart bzz ur not!!!!
bzz ur not ? Man, are you this stupid, or do you think that being unable to spell makes you cool ?
wgdesigner wrote:
I want to find out the two record in database first and last record without veiwing the database tell me
Why would I tell you ? Because I 'know nothing', or because you've just been insulting me ?
wgdesigner wrote:
iam a graduate in computer science understood...
You're a graduate but you can't spell and you can't string together a simple SQL query ? I doubt it.....
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|