|
Have you read the documentation? What code have you written so far?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
hi
till now i wrote
CREATE TRIGGER trginsert
AFTER INSERT ON table1
FOR EACH ROW
INSERT INTO table2(unit,id) values('888','999');
i will get data through a device whenever a record is inserted into the master table the same record has to be added into another table
this is my req hope i was clear
padma
|
|
|
|
|
When a trigger fires for an insert/update, the new data can be accessed through a logical table named inserted.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
This KB article[^] has given me a good starting point except it is ADO.NET with managed C++. Would anyone know of an article that is ADO with native C++ and would connect to SQL Server 2005 Express Edition. Thanks.
|
|
|
|
|
hi all, the Bolow Query find me Records that have Duplicates,
select Property_ID,Lis_key from Property_Private
group by Property_ID,Lis_key
Having count(Property_ID) = 2
order by Property_ID .
Now Property_ID is not a Primary_key, in this table, i have created another Field and named it "Primary_key", that will be an identity Column and a Primary key. So from the above Query i want to delete only the record that have been found by this query.
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
|
Hi,
What would be the best way of making a transaction from a aspx webpage to the SQL database for example,
where a customer orders a product, hits the order button and then this transaction goes through to the database where it automatically updates the records. Any ideas?
cheers
|
|
|
|
|
Your button handler will be responsible for reading the data from the page. A separate layer will contain code which will map to an insert into a database (this insert will be done through a stored procedure). In the case of an update, use an update statement instead of an insert.
|
|
|
|
|
hi , first i would thank you for help
i have a column in table contains a code for students
the code format is 11-1-07-0001
what i want , i want to replace the first tow digits from 11 to 01
without any efection to the other characters
MD_NADA
|
|
|
|
|
did you try it with SUBSTRING?
spaps
|
|
|
|
|
This is not something that happens to me every day... for once i can finally give help to someone else and not be the one asking the question
SELECT YourStudentNumberColumn AS [Test],<br />
'01' + SUBSTRING(YourStudentNumberColumn,3,LEN(YourStudentNumber) - 2) AS [TestAfterUpdate]
Notice the 3 in the substring , this is the start position. The LEN(YourStudentNumber) - 2 is the amount of character to use. So it will start at position 3 being the first '-' in your student number and end at the end of the student number as it gets the length of the YourStudentNumber subtracts 2 as you start at position 3 (the first '-'). If this is unclear run the query in sql and change the '- 2' to '- 3' and you will see what it does.
the SUBSTRING works like this.
Substring(YourValue, StartPosition(1 for beginning of your value), AmountOfCharacters)
I added the select statement so that you can make sure that this is the correct value that you need.
If it is... you can run it like this for the UPDATE :
UPDATE YourTableName<br />
SET YourStudentNumberColumnName = '01' + SUBSTRING(YourStudentNumberColumnName,3,LEN(YourStudentNumber) - 2)
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
thank you very much , this is what i want
i dont have any words to say
but i am thankfull for any one in the world liks to help the others
MD_NADA
|
|
|
|
|
hi
i had to create Rowlevel triggers and my req is-- if a new row is added in table1 then the same current row has to be updated in my table2.please can anybody help me
padma
|
|
|
|
|
CREATE TRIGGER sdfsd
ON Table1
FOR UPDATE
IF (UPDATE(Column1)
UPDATE Table2 SET Column1 = i.Column1
FROM Table2 t2
INNER JOIN INSERTED i ON i.RowID = t2.RowID
|
|
|
|
|
dandamudi padma wrote: if a new row is added in table1
Did you mean when a row is UPDATE same row has to be updated on table2?
|
|
|
|
|
thanks for ur reply but
what i mean is if a row is inserted in table1 after insert the same row has to be Inserted in table2.
can u give solution for this
Regards
padma
padma
|
|
|
|
|
Hi,
How can I transfer a DB from SQL Server 2005 to 2000 completely(with all tables, diagrams, stored procedures and ...)
Best wishes
|
|
|
|
|
mehrdadc48 wrote: How can I transfer a DB from SQL Server 2005 to 2000 completely(with all tables, diagrams, stored procedures and ...)
I think you can "Attach" the database from 2005 to the 2000 server. You will need to stop the SQL service before doing this.
|
|
|
|
|
Hi,
Can you set a column to store data right aligned? (the reason i want to know this is because all our values are set to char() datatype in SQL database. This will mean that the left out characters / the character that are short will be filled in with blank spaces. Having the value right aligned will mean that the spaces will be put in front of the value and not at the back and that is what i am looking for (if this is possible).)
OR
is there a way to select the values from the database as right aligned (i will be using the REPLACE(TheRecordFromTheTable, ' ','') , this will help to remove the added spaces from the back due to char() datatype.)
Thank you in advance...
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
hi
plz clarify your question...
Regards
Joe
|
|
|
|
|
Support123 wrote: is there a way to select the values from the database as right aligned
May I know what is your objective in doing so?
|
|
|
|
|
Is this what you are trying
declare @a char(20)<br />
set @a = 'testing'<br />
select right(space(20) + rtrim(@a), 20)
1. Removing spaces at end
2. Adding at the begining
3. Ignoring extra spaces from begining
Regards
KP
|
|
|
|
|
Support123 wrote: Can you set a column to store data right aligned? (the reason i want to know this is because all our values are set to char() datatype in SQL database. This will mean that the left out characters / the character that are short will be filled in with blank spaces. Having the value right aligned will mean that the spaces will be put in front of the value and not at the back and that is what i am looking for (if this is possible).)
OR
is there a way to select the values from the database as right aligned (i will be using the REPLACE(TheRecordFromTheTable, ' ','') , this will help to remove the added spaces from the back due to char() datatype.)
Is there a particular reason why you are storing numbers as strings? Wouldn't storing numbers as binary fields be more efficient?
|
|
|
|
|
Thank all of you...
BUT never mind... i found a way around my problem... sorry for stating my question so unclear. I wasn't even sure what i needed.
What i wanted to do is add the spaces in front of some of the Values in the database. This is then easier when i have to populate the flatfile using ssis package. (The reason why i store the numbers as CHAR() is just a staging table. Easier to get the fixed length right )
Thank you all once again for the effort.
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
i have applied the following query but in output one record appears repeatedly, can u check whether there is any error in query santax, perhaps i have used 'AND' 2 TIMES
SELECT crime_mgmt.cr_location,crime_mgmt.cr_date,offensive_issue.c_desc FROM crime_mgmt,offensive_issue WHERE crime_mgmt.fir_num = offensive_issue.fir_num AND crime_mgmt.cr_date BETWEEN '" + crimewithdate.text.ToString() + "' AND '" + crimewithdate.text1.ToString() + "'ORDER BY crime_mgmt.cr_date ASC
|
|
|
|