|
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
|
|
|
|
|
SELECT crime_mgmt.cr_location,crime_mgmt.cr_date,offensive_issue.c_desc
FROM crime_mgmt inner join offensive_issue on crime_mgmt.fir_num = offensive_issue.fir_num
WHERE crime_mgmt.cr_date BETWEEN '" + crimewithdate.text.ToString() + "' AND '" + crimewithdate.text1.ToString() + "'ORDER BY crime_mgmt.cr_date ASC
and dont forget to enclose it properly as far as thequotes are concerned. you're better off chking the value of the actual query formed while debugging.
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
Could be possible of your date format. just try to check your input date and date store in table.
Devjit Das.
|
|
|
|
|
mavii wrote: have applied the following query but in output one record appears repeatedly
This can happen when there are multiple rows for same "fir_num"
can you provide table structure with sample data.
Regards
KP
|
|
|
|
|
Interesting, and quite disappointing, that no one picked you up on the fact that your code is susceptable to a SQL Injection attack.
Please learn about SQL Injection Attacks and tips on how to prevent them[^] - most likely by following that advice you will solve other problems as well.
|
|
|
|
|
Colin Angus Mackay wrote: Interesting, and quite disappointing, that no one picked you up on the fact that your code is susceptable to a SQL Injection attack
I'm sorry Colin. I didn't even read his post until after I read your response. Mind you, it's interesting that the system he was working on had something to do with crime management (I'm inferring this from the table name). I would have thought that he'd want to make things as secure as possible beforehand.
|
|
|
|
|
Pete O`Hanlon wrote: I would have thought that he'd want to make things as secure as possible beforehand.
Indeed. Unless, of course, he's in league with certain elements.....
|
|
|
|
|
Hi,
i'm searching for a stored procedure (or other way) to create scripts from objects in a database, given the object as parameter.
Reason i do this is :
I want to create a script of all objects modfied after a certain date. Those i can retrieve using
select * from sys.all_objects where /*name like 'tbl_%' and*/ modify_date > '2007-10-29'
but now i want to create automatically a script of those modified objects.
Thx
Kurt
|
|
|
|
|
hi
You can use EnterPriseManager to create the script of objects.
Then why r u searching for Stored Procedures.
Reagrds
Joe
|
|
|
|
|
hi,
i want it to generate automatically, not using the enterprise manager or studio..
a select from systemobjects and use those to generate all new or modified tables, triggers and stored procs... in one action, without selecting them yourself.
greetz
kurt
|
|
|
|
|
hi genius people i need help again.. and tnx again in advance!!!
i just want to get the execution time of every query made or views or stored procedure executed.. just like in the query analyzer when you execute a command or any query.. i just want it displayed while on
run time or after the run time
is it possible?or am i just too newbie for this..
|
|
|
|
|
Hi all
How to convert FLOAT to INT in SQL Server2000
When i use cast or convert function get this error
Server: Msg 232, Level 16, State 3, Line 1
Arithmetic overflow error for type int, value = 2400000000.000000.
The statement has been terminated.
Thank
|
|
|
|
|
Max value for INT data type is 2147483647
Use BIGINT as the value you are trying to convert is more than the max value of INT
Regards
KP
|
|
|
|
|
It is clear, but if i'm still needed to convert bigest value to more easy, is an way exists???
|
|
|
|