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

sql¼òµ¥º¯ÊýÓ÷¨

¶¨Ò庯Êý
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER function [dbo].[FunJSLC](@carid bigint,@date datetime)
returns decimal
as
begin
declare @jslc decimal
set @jslc=(select JSLC from BYReMIn where iCarID=@carid and dtDate=@date)
return(@jslc)
end
´æ´¢¹ý³ÌÓ¦Óú¯Êý
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER proc [dbo].[BYProc]
as
declare @jglc decimal
select cCode,dtDate ,cLBName,dMoney ,JSLC=dbo.FunJSLC(iCarID,dtDate),
JGLC=(dbo.FunJSLC(iCarID,dtDate)-dbo.Funccclc(iCarID)),
CCLC=dbo.Funccclc(iCarID),cHandler,cUName,cBYXM,cMemo into #t  from vBYB
select cCode as '³µÅƺÅ',dtDate as '±£ÑøÈÕÆÚ',cLBName as '±£ÑøÀà±ð',dMoney as '±£Ñø·ÑÓÃ',
JSLC as 'Éϴα£ÑøÀï³Ì',CCLC as 'µ±Ç°Àï³Ì',cHandler as '¾­ÊÖÈË',cUName as '±£Ñøµ¥Î»',
cBYXM as '±£ÑøÏîÄ¿',cMemo as '±¸×¢'
 from #t where CCLC>JSLC
dbo.FunJSLC(iCarID,dtDate)¼´º¯ÊýFunJSLCµÄ·µ»ØÖµ
Á˽â×î»ù±¾µÄ¶¨Òåµ÷ÓûáÓþÍOK
ÕâÑùʵÏÖͳ¼ÆµÄʱºò¾Í·½±ã¶àÁË£¬ÓÃsqlÈ¥´¦Àí£¬Ê¹³ÌÐò´úÂë¼ò½à£¬ÓÐЧÂÊ£¡


Ïà¹ØÎĵµ£º

asp.netÁ¬½ÓsqlÓõÄSqlHelper

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Collections;
using System.Data.SqlClient;
namespace DAL
{
    /// <summary>
    /// Êý¾Ý¿âµÄͨÓ÷ÃÎÊ´úÂë
    /// ´ËÀàΪ³éÏóÀ࣬²»ÔÊÐíʵÀý»¯£¬ÔÚÓ¦Óà ......

MS SQL ServerºÍMySQLÇø±ð

1 MySQLÖ§³Öenum,ºÍsetÀàÐÍ£¬SQL Server²»Ö§³Ö
¡¡¡¡2 MySQL²»Ö§³Önchar,nvarchar,ntextÀàÐÍ
¡¡¡¡3 MySQLµÄµÝÔöÓï¾äÊÇAUTO_INCREMENT£¬¶øMS SQLÊÇidentity(1,1)
¡¡¡¡4 MS SQLĬÈϵ½´¦±í´´½¨Óï¾äµÄĬÈÏÖµ±íʾÊÇ((0)),¶øÔÚMySQLÀïÃæÊDz»ÔÊÐí´øÁ½À¨ºÅµÄ
¡¡¡¡5 MySQLÐèҪΪ±íÖ¸¶¨´æ´¢ÀàÐÍ
¡¡¡¡6 MS SQLʶ±ð·ûÊÇ[],[type]±íÊ ......

SQL SERVER ÈçºÎ¶ÁÈ¡Ò³ÃæÉϵÄÊý¾Ý

CSDNÉÏÓÐƪÌû×Óhttp://topic.csdn.net/u/20100223/15/644e6212-9fdc-42de-81ad-785d28ed71d3.html
ÌÖÂÛ²éѯ¼Æ»®¶ÁÈ¡Ë÷ÒýÒ³µÄÎÊÌâ¡£
Ö÷ÒªÎÊÌâÊÇ£º ÔÚÒ»ÕŽ¨Óоۼ¯Ë÷Òý£¨Ã»ÓÐÆäËü·Ç¾Û¼¯Ë÷Òý£©µÄ±íÖ´ÐÐselect count(*) ¡£²éѯÏÔʾɨÃèÁËËùÓеÄË÷ÒýÖмä²ãÒ¶¡£´ÓÀíÂÛÉϽ²£¬ÓÉÓÚÿ¸öÊý¾ÝÒ³¶¼¼Ç¼×ÅËüµÄÉÏÒ»¸öpageºÍÏÂÒ»¸öpage, ......

SQL 2005 xml ´¦ÀíµÄһЩsample

USE Test
--Create 2 tables as an example
CREATE TABLE ExampleTable
(
[ID] int PRIMARY KEY
,[Name] nvarchar(256)
)
CREATE TABLE ExampleTable2
(
[ID] int PRIMARY KEY
,[Name] nvarchar(256)
)
----way1
SELECT *
from sys.objects [table]
WHERE
[Name] LIKE 'ExampleTable%'
FOR XML AUTO, ROOT ......

SQLÊý¾Ý¿â Ô¤·À·Ç·¨±íD99_Tmp,kill_kkµÄ½¨Á¢

·ÀÖ¹·Ç·¨±íD99_Tmp,kill_kkµÄ³öÏÖÊÇ·ÀÖ¹ÎÒÃǵÄÍøÕ¾²»±»¹¥»÷,ͬʱҲÊÇSQL°²È«·À·¶Ò»µÀ±ØÒªµÄ·ÀÏß,Ëä˵ÀûÓÃÕâÖÖ·½Ê½¹¥»÷µÄÈ˶¼ÊǺڿÍÖеÄСÄñ,µ«ÊÇÎÒÃÇÒ²²»µÃ²»·À,ÒÔÃâÔì³É²»¿ÉÏëÏóµÄºó¹û,·Ï»°²»¶à˵ÁË,˵Ï·À·¶·½·¨:
xp_cmdshell¿ÉÒÔÈÃϵͳ¹ÜÀíÔ±ÒÔ²Ù×÷ϵͳÃüÁîÐнâÊÍÆ÷µÄ·½Ê½Ö´Ðиø¶¨µÄÃüÁî×Ö·û´®,²¢ÒÔÎı¾Ðз½Ê½·µ»ØÈκÎÊ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ