Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

SQL ±êÁ¿Öµº¯ÊýµÄµ÷ÓÃ

µ÷Óà MS SQL ±êÁ¿Öµº¯Êý£¬Ó¦¸ÃÔÚº¯ÊýÇ°Ãæ¼ÓÉÏ "dbo."£¬·ñÔò»á±¨ “²»ÊÇ¿ÉÒÔʶ±ðµÄ ÄÚÖú¯ÊýÃû³Æ”´íÎó¡£ÀýÈç
    DECLARE @WhichDB TINYINT;
    SELECT @WhichDB = user_GetWhichDB(1);--¿´¿´ÊÇÄĸöÊý¾Ý¿âµÄ
=================================================
--±êÁ¿Öµº¯Êý
ALTER FUNCTION [dbo].[user_GetWhichDB]
(
    @UserId INT = 0
)
RETURNS TINYINT
WITH EXECUTE AS CALLER
AS
BEGIN
    DECLARE @WhichDB TINYINT;
    SET @WhichDB = 1;
    IF @UserId >= 115098
        SET @WhichDB = 2;
   
    RETURN (@WhichDB);
END


Ïà¹ØÎĵµ£º

»ùÓÚSQL Server ·ÖÒ³´æ´¢¹ý³ÌµÄÑݽø

 
»ùÓÚSQL Server ·ÖÒ³´æ´¢¹ý³ÌµÄÑݽø ÊÕ²Ø
Õë¶ÔÊý¾Ý¿âÊý¾ÝÔÚUI½çÃæÉϵķÖÒ³ÊÇÀÏÉú³£Ì¸µÄÎÊÌâÁË£¬ÍøÉϺÜÈÝÒ×ÕÒµ½¸÷Ö֓ͨÓô洢¹ý³Ì”´úÂ룬¶øÇÒÓÐЩ»¹¶¨ÖƲéѯÌõ¼þ£¬¿´ÉÏȥʹÓúܷ½±ã¡£±ÊÕß´òËãͨ¹ý±¾ÎÄÒ²À´¼òµ¥Ì¸Ò»Ï»ùÓÚSQL SERVER 2000µÄ·ÖÒ³´æ´¢¹ý³Ì£¬Í¬Ê±Ì¸Ì¸SQL SERVER 2005Ï·ÖÒ³´æ´¢¹ý³ÌµÄÑ ......

½«ExcelÎļþÊý¾Ý¿âµ¼ÈëSQL ServerµÄÈýÖÖ·½°¸

 ½«ExcelÎļþÊý¾Ý¿âµ¼ÈëSQL ServerµÄÈýÖÖ·½°¸
//·½°¸Ò»£º ͨ¹ýOleDB·½Ê½»ñÈ¡ExcelÎļþµÄÊý¾Ý£¬È»ºóͨ¹ýDataSetÖÐתµ½SQL Server
openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "Excel files(*.xls)|*.xls";
if(openFileDialog.ShowDialog()==DialogResult.OK)
{
    FileInfo ......

sql server ´æ´¢¹ý³Ì¼°´¥·¢Æ÷

Ò»Ö±¶¼ÏëÕÒ¸öʱ¼äÑо¿Ò»Ï£¬½ñÌ컨ÁËÒ»Ììʱ¼äȥʵ¼ùÁËһϣ¬·Ç³£ÓÐÓ᣿ÉÒÔ˵ÊÇÊý¾Ý¿âÀïÃæµÄ¾«»ª°É¡£»¹ºÃÎÒ½ñÌìȥŪÁ˼¸Ï£¬Ëä˵¶¼ÊÇЩ¼òµ¥µÄÓï¾ä£¬µ«ÊÇ×îÆðÂëÖªµÀÒÔºóÔÚÏîÄ¿¸ÃÔõôȥ×öÁË¡£ Ïл°ÉÙ˵¡£½øÈëÕýÌâ¡£
1.´´½¨SQL´æ´¢¹ý³Ì:
   CREATE PROCEDURE stu_proc1//Ö¸¶¨¹ý³ÌÃû
    @Sno varc ......

±Ø±¸sqlÓï¾ä

 1.¶Á³ö±íÖеÄ×Ö¶ÎÃû
ResultSet  rs = test.selectSql("SELECT * from datainfo");  
java.sql.ResultSetMetaData md=rs.getMetaData();   //¶Á³öÊý¾Ý¿âµÄ×Ö¶ÎÃû
   int nColumn=md.getColumnCount();   //×Ö¶Î×ÜÊý
   for(int i=0;i<nColumn;i++)
& ......

SQLÖ®COLLATE ×Ó¾ä ÅÅÐò¹æÔò

COLLATE ÊÇÒ»¸ö×Ӿ䣬¿ÉÓ¦ÓÃÓÚÊý¾Ý¿â¶¨Òå»òÁж¨ÒåÒÔ¶¨ÒåÅÅÐò¹æÔò£¬»òÓ¦ÓÃÓÚ×Ö·û´®±í´ïʽÒÔÓ¦ÓÃÅÅÐò¹æÔòת»»¡£
Óï·¨
COLLATE { <collation_name> | database_default }
<collation_name> :: =
     { Windows_collation_name } | { SQL_collation_name }
²ÎÊý
collation_name
  ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ