|
Hi,
did you receive my email ?
|
|
|
|
|
Hi Guy's
I want to Create a trigger on 'Table1' by which at the time of insertion the same data will be insert in to another table 'Table2' of same database please help me.
Sasmi
|
|
|
|
|
Try this:
CREATE TRIGGER [InsertIntoTable2] ON [Table1]
FOR INSERT
AS
INSERT INTO Table2
SELECT (Field1, Field2, (and so on)) FROM INSERTED
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
Problem: Get all records from MyTable where mydate value is equal to ‘12/31/2006’. Note: Disregard TimeStamp
I know the solution in T-SQL but in PL-SQL i'm just a newbie.
Can you please help me to convert the below T-SQL comannd to PL-SQL.
---TSQL Solution 1: Use 24hrs timespan
SELECT * FROM MyTable
WHERE MyDate BETWEEN '12/31/2006 12:00:00.000 AM' AND '12/31/2006 12:59:59.999 PM'
---TSQL Solution 2: REMOVE TimeStamp
SELECT * FROM MyTable
WHERE RTRIM(CONVERT(VARCHAR(11),MyDate,101)) = ‘12/31/2006’
Thanks,
|
|
|
|
|
Doesn't PL/SQL still have a Truncate or DateTruncate function?
(Haven't used Oracle for many years.)
|
|
|
|
|
I want develop a database managment module in a DLL that is dynamically loaded at run time , i thought i have problems using ADO beacuse it's contained in another DLL .. which should i use ADO, ODBC or OLE DB ..??
|
|
|
|
|
I'm having a stupid problem:
when I try to use INSERT sentance
INSERT INTO .... VALUE(N 'walla',x);
the first parameter (walla) is ging well
the second parameter (x) is making my prog. stack!
I checked the atrribute of the collumns
and it's like the variable x (int).
can anyone help me?
|
|
|
|
|
It would be better if you showed us the code you are actually using because your description appears to be missing some vital bit of information.
My guess, based on the limited information you've provided, is that x is not a valid column name available to the INSERT statement. However, I get the impression that you think x is a variable name. It isn't.
If it is what I think it is then show some code and I can show you how to fix it.
|
|
|
|
|
I wrote:
int x = 10;
int y = 20;
str= "INSERT INTO table1 (C1,C2) VALUES (x,y)";
I called the sqlCommand object with this str santence.
and then the ExecuteNonQuery(); method.
the collumns C1 and C2 declared as int;
|
|
|
|
|
groundzero111 wrote: int x = 10;
int y = 20;
str= "INSERT INTO table1 (C1,C2) VALUES (x,y)";
There's your problem then. As x and y are inside the quotes, they are treated as literals. You would need to do this as:
str= string.Format("INSERT INTO table1 (C1,C2) VALUES ({0},{1})",x,y);
Before you go any further with this though, I would like to point out that it is a very bad idea to build your SQL like this and execute it. While you are only using local variables here, you will eventually want to move onto inserting data that has been input by a user and this is open to SQL Injection Attacks. See this article for more information:
SQL Injection Attacks[^]
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hello,
I want to write a query something like the following
UPDATE INCOMETABLE SET NAME ='PETER',AGE=30 WHERE RECORDNO = 10;
In the above what should be the keyword of RECORDNO
or there is another way of writing it
THANKS
Prithaa
|
|
|
|
|
Hi,
There is not such a keyword in Sql Server.
(There is one in Oracle, but it's a bad practice to use it in such a case)
What you should do is to use a primary key in the INCOMETABLE table.
UPDATE INCOMETABLE SET NAME ='PETER',AGE=30 WHERE EMPLOYEEID = 10
Uri
|
|
|
|
|
Hello,
Thanks,I got it.
Prithaa
|
|
|
|
|
i have two tables in my database parentTbl with primary key id and childTbl with foreign key pId. i created a relationships between them is it possible to ensure that the record in the parentTbl can not be deleted if it is been used in a record in childTbl.
i want to this from a database level i know if i was using store procedure i could always put a check but i was wondering if open the database and the table directly and try to delete record if i can set up the constraints to even prevent this from occurring once there is a corresponding record in the childTbl
|
|
|
|
|
This is what a foreign key is for. Ensure that it doesn't perform a cascade delete then the database will take care of this for you automatically.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
What is the best practice to get multiple output values of stored procedures from ASP.net...
I am doing as below. IS it best practice or you have some good suggestion?
1) At the end of my SP, I am doing SELECT for all output parameters.
2) In ASp.net, i am calling SP thru ExecuteReader from DAL layer.
3) Storing datareader in DATATABLE in Business Layer
4) Passing DataTable to UI layer.
Please suggest....
Amit
|
|
|
|
|
Amit Kumar G wrote: 1) At the end of my SP, I am doing SELECT for all output parameters.
Do you mean you have multiple parameters where the direction is set to output, or do you mean you just call SELECT several times.
Amit Kumar G wrote: 2) In ASp.net, i am calling SP thru ExecuteReader from DAL layer.
3) Storing datareader in DATATABLE in Business Layer
This is what a data adapter already does. You should try and avoid duplicating functionality - unless of course you have some subtle, but important, differences between what the data adapter produces and what you are producing.
Amit Kumar G wrote: 4) Passing DataTable to UI layer.
Personally, I wouldn't pass a data table to the UI unless it was an application to manipulate databases. I'd have the data transformed into business objects and pass the business objects to the UI.
|
|
|
|
|
Colin Angus Mackay Wrote:
Do you mean you have multiple parameters where the direction is set to output, or do you mean you just call SELECT several times
Reply : Multiple paramters set as Output
Amit
|
|
|
|
|
Hi friends
I know that System.Transaction works with SQL Server 2005, but .... Does it work with SQL Server 2000, or Oracle ?
Thanks in advance
PD: happy 2k7
|
|
|
|
|
how consistancy is maintained when a number opf different user tries to update arecord at the same time
|
|
|
|
|
Kumar Nilesh wrote: how consistancy is maintained when a number opf different user tries to update arecord at the same time
The database locks the rows when updates are happening.
|
|
|
|
|
Hello Im a beginner one in programming. My first problem is, How can i view a image file from the database(sql 2005) as "image" to visual basic 2005.
for example:
a text viewed in the textbox from database.
the code is.
textbox1.text=rs.fields("text").value
My problem is how can i view the image from database if the image DATA TYPE IS "image".
Please help me. Thank you very much and God bless.
|
|
|
|
|
naglayas wrote: rs.fields("text").value
What is rs ? I don't recognise any class that has a fields method on it.
naglayas wrote: My problem is how can i view the image from database if the image DATA TYPE IS "image".
The value in an image column will arrive as a byte array. What you do with that byte array really depends on what it actually represents.
|
|
|
|
|
Colin Angus Mackay wrote: What is rs?
|
|
|
|
|
Paul Conrad wrote: Colin Angus Mackay wrote:
What is rs?
Well, yes, those were exactly my thoughts. The OP has some code with an object called rs and he expects us to know what it is. I've no idea what it is, so it makes it very difficult to help.
|
|
|
|