sql ÎʸßÊÖ
Êý¾Ý¿â
id subject shu liang Ò» ¶þ Èý
1 Ò» 100 200
2 ¶þ 333 111
3 Èý 44 55
Çó°ÑÿÐеÄsubjectµÄ¶ÔÓ¦ÁеÄÖµÓÃshu ºÍliangµÄºÍÌî³ä
½á¹ûÓ¦¸ÃÈçÏÂ
id subject shu liang Ò» ¶þ Èý
1 Ò» 100 200 300
2 ¶þ 333 111 444
3 Èý 44 55 99
ÕâÊÇÎҵķ½·¨£¬ÎÒ¾õµÃÂ߼ûÎÊÌ⣬µ«ÊÇÓÐÒ»¸ö´íÎó
ÏûÏ¢ 245£¬¼¶±ð 16£¬×´Ì¬ 1£¬µÚ 10 ÐÐ
ÔÚ½« nvarchar Öµ 'update sales set Ò»= shu + liang where id=' ת»»³ÉÊý¾ÝÀàÐÍ int ʱʧ°Ü¡£
Çë´ó¼Ò°ïÎÒ£¬Èç¹ûÓÐÆäËû·½·¨Ò²ÐÐ
declare @id int,@name nvarchar(50), @Sql1 nvarchar(500)
declare newCursor Cursor for select id,subject from sales
open newCursor
fetch next from newCursor into @id,@name
while @@fetch_status = 0
begin
set @Sql1 = 'update sales set ' + @name + '= shu + liang where id=' + @id
exec sp_
Ïà¹ØÎÊ´ð£º
±¾ÈËc#ÐÂÊÖ ¿ÉÊÇÒªÇóÒªÓÃc# £¬sql2000¿ª·¢c/sµÄ¹¤×÷Á÷£¬Ò»Í·ÎíË®£¬Çë´ó¼Ò°ïæ°ï棬¸øµã˼·£¬ËµµÄÔ¼¾ßÌåÔ½ºÃ£¬ÎÒÒ²ºÃÍùÄǸö·½ÃæÈ¥Ñ§Ï°
http://www.hxzi.com/view/61402.html
B/S°æµÄ£¬»ù±¾Ë¼ÏëÓ¦¸Ã²î²»¶àµÄ¡£¡£ ......
»·¾³£º1.win2003server+oracle9i
2.oracle9i×Ö·û¼¯ÎªAMERICAN_AMERICA.WE8ISO8859P1
3.oracle sql developer°æ±¾ 1.5.5
ÏÖÏóÃèÊö: 1.ÔÚsql developer ÖвéѯoracleÖеÄij¸ö±í£¬ÖÐÎÄÈ«²¿ÏÔʾΪÂÒÂë¡£
......
ÒÑÖª´ÓB,±íÖÐÕÒ³öID, NAMEÁ½ÏîÓëC±íÏàͬµÄÊý¾Ý£¬ÔÙÒÀ¾ÝB±íÖо¹ý²éѯ³öÀ´µÄID,CODEÁ½ÏîÊý¾Ý²éѯÓëA±íID,CODEÁ½ÏîÏàͬµÄÊý¾ÝÖжÔÓ¦µÄEMAILÀ´£¬²¢ÁгöÈçÏÂD±íµÄÐÎʽ£¬²»ÖªÎÒÊÇ·ñ±íʾÇå³þ£¿Âé·³°ïÎÒÁÐһϹ«Ê½ºÃÂð£¿Íò· ......
sql¿ÉÒÔÓÐÁ½¸öÒÔÉϵĴ¥·¢Æ÷Â𣿣¿ÎÒÖ¸µÄÊÇfor´¥·¢Æ÷£¬ÄÇÆäËûµÄÄØ£¿£¿
ʲôÒâ˼£¿
¿ÉÒÔµÄ
10¸ö¶¼Ã»ÎÊÌâ
¿ÉÊÇÎÒдÁËÁ½¸öfor insert ´¥·¢Æ÷£¬Ôì³É½ø³Ì×èÈûÁËÄØ£¿Ôõô°ìÄØ£¿Çë¸ßÈËÖ¸µã
......
£¨1£©string ConnString = "server=localhost;integrated security=sspi;database=pubs;";
£¨2£©string strConnection="user uid=sa;pwd=123456;Database=test;Server=test;Connect ......