Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Old Forums
 CLOSED - General SQL Server
 updating column

Author  Topic 

cshah1
Constraint Violating Yak Guru

347 Posts

Posted - 2005-05-18 : 10:17:16
Right now I can update column value using enterprise manager (column value is either html or javascript code)

Enterprise manager's GUI is handy for such update but just curious an easy way to do this in Query Analyzer.

How to update column using Query Analyzer, I might have to escape some single and double quotes..

UPDATE MyTABLE
SET Column=<javascript_code_below>
WHERE talble_id = <id_here>

<script language=JavaScript>
varRefDir = "@RefDir";
varCode = varRefDir.substring((varRefDir.indexOf('uid=')) + 4,varRefDir.length);
document.writeln("<img src=https://www.mysite.com?uid=" + varCode + " width=1 height=1>");
</script>

SreenivasBora
Posting Yak Master

164 Posts

Posted - 2005-05-18 : 10:30:05
yes.
1. Declare a variable varchar(8000) or Text column for storing of huge HTML text.
2. Write a simple User defined function to change the single quotes into double codes format
3. Update Table set column1 = dbo.fn_ChangeQuoteIdentifier(@Variable)
WHere <Conditions>


With Regards
Sreenivas Reddy B
Go to Top of Page

cshah1
Constraint Violating Yak Guru

347 Posts

Posted - 2005-05-18 : 11:44:43
Thanks!
Go to Top of Page
   

- Advertisement -