SQLº¯Êýµ÷ÓÃ
º¯ÊýÈçÏÂ
CREATE FUNCTION StockBalance_AmountIn(@SortID int)
RETURNS numeric(18,4)
AS
BEGIN
Declare @dblReturn numeric(18,4)
Select @dblReturn = SUM(AmountCurrentMonthIn) from AT_Materiel_StockBalance Where SortID = @SortID
Return (@dblReturn)
END
µ÷Ó÷½·¨
select dbo.StockBalance_AmountIn(2523)
ÕâÀïÍ·ÐèÒª¼Ódbo
=========================
±í¸ñ±äÁ¿
USE [mbmxdb]
GO
/****** Object: UserDefinedFunction [dbo].[uf_GetResearcherTable] Script Date: 04/23/2010 09:50:47 ******/
SET QUOTED_IDENTIFIER ON
GO
CREATE function [dbo].[uf_GetResearcherTable](@UserID varchar(50))
returns @t table(col varchar(50))
as
begin
declare @temp table (ID int IDENTITY (1, 1) NOT NULL , OrderRight varchar(10),Researcher varchar(50))
declare @ResearcherInfo varchar(50)
DECLARE @ID int
SET @ResearcherInfo=''
insert into @temp(OrderRight,Researcher)
( SELECT
RI.OrderRight as OrderRight,
(CASE WHEN RI.IsAnalyst=1 THEN '·ÖÎöʦ'+'£º'+UserName
ELSE 'ÁªÏµÈË'+'£º'+UserName
END) as Researcher
from kinghing..vemployeeinfo_yjs Vyjs Inner Join
(
Select
DISTINCT MR.RelatedID,MR.OrderRight,MI.IsAnalyst,MR.Type,MR.NameFontStyle,MR.PhoneFontStyle,MR.EmailFontStyle,MR.Separator,Mi.CertificateID
from MBMXResearcherInfo MI Inner Join
(Select RelatedID,OrderRight,Type,NameFontStyle,PhoneFontStyle,EmailFontStyle,Separator from MBMXResearcherInfoReferNew where UserID=@UserID) MR
On MI.UserID=MR.RelatedID
) RI
On Vyjs.UserID=RI.RelatedID where Vyjs.userstatus <4
)
WHILE ((
Ïà¹ØÎĵµ£º
Use DatabaseName
--DB shrink
--»ñÈ¡database ¿ÕÓà¿Õ¼ä£¬¡¡¾ö¶¨ÊÇ·ñ×÷shrinkDB
exec [DBNAME].dbo.sp_spaceused
DBCC ShrinkDB(DBNAME)
--Log file shrink
Use DatabaseName
GO
Alter Database DatabaseName Set Recovery Simple
GO
Alter Database DatabaseName Set Recovery Full
GO
DBCC SHRINKFILE ('Log ......
ÔÚÍøÉÏ¿´µ½Ò»¸öºÜºÃµÄÀý×Ó½²½âinºÍexistsµÄÇø±ð£¬ÕâÀﱸÍüÏ¡£
±¾Ê¾ÀýËùʾ²éѯ²éÕÒÓÉλÓÚÒÔ×Öĸ B ¿ªÍ·µÄ³ÇÊÐÖеÄÈÎÒ»³ö°æÉ̳ö°æµÄÊéÃû£º
USE pubs
SELECT title
from titles WHERE EXISTS
(SELECT *
from publishers
WHERE pub_id = titles.pub_id ......
Êý¾Ý¿âÃæÊÔ³£ÓòâÊÔÌâ(SQL Server)
ÌâÄ¿1
¡¡¡¡ÎÊÌâÃèÊö:
¡¡¡¡Îª¹ÜÀí¸ÚλҵÎñÅàѵÐÅÏ¢£¬½¨Á¢3¸ö±í:
¡¡¡¡S (S#,SN,SD,SA) S#,SN,SD,SA ·Ö±ð´ú±íѧºÅ¡¢Ñ§Ô±ÐÕÃû¡¢ËùÊôµ¥Î»¡¢Ñ§Ô±ÄêÁä
¡¡¡¡C (C#,CN ) C#,CN ·Ö±ð´ú±í¿Î³Ì±àºÅ¡¢¿Î³ÌÃû³Æ
¡¡¡¡SC ( S#,C#,G ) S#,C#,G ·Ö±ð´ú±íѧºÅ¡¢ËùÑ¡Ð޵Ŀγ̱àºÅ¡¢Ñ§Ï°³É¼¨
¡¡¡¡1. Ê¹Ó ......
֮ǰΪÁË·½±ã²Ù×÷¾ÍÔÚSql ServerµÄÆóÒµ¹ÜÀíÆ÷Àï×¢²áÁËÔ¶³Ì·þÎñÆ÷£¬µ«ÊÇǰһ¶Îʱ¼äÔÚÔ¶³Ì·þÎñÆ÷ÉÏÐÞ¸ÄÁ˸ÃÊý¾Ý¿âµÄÃÜÂ룬ÿ´Îµã»÷¸Ã×¢²á·þÎñÆ÷ϵͳҪµÈºÜ³¤Ê±¼ä£¬ÏóËÀ»úÒ»Ñù£»ÐÞ¸ÄÁ¬½ÓÊôÐÔÒ²Ð޸IJ»ÁË£¬µã»÷ºóҲûÓз´Ó¦£¬ÓÚÊǾÍÏëɾ³ýÖØÐÂ×¢²á£¬¼ÈÈ»ÎÞ·¨ÔÚ¹ÜÀíÆ÷Àïɾ³ý£¬¾ÍÏë´Ó×¢²á±íÀïɾ³ý£¬ÕÒÁ˺þÃÖÕÓÚÕÒµ½ÁË£¬¶ÔÓ¦µÄsql ......
Ê×ÏȵÃÏÂÔØÇý¶¯³ÌÐòµ½Î¢ÈíÍøÕ¾ÏÂÔØMicrosoft SQL Server 2005 JDBC Driver 1.2
½âѹMicrosoft SQL Server 2005 jdbc driver1.2.exe£¬°Ñsqljdbc_1.1¸´ÖƵ½%ProgramFiles%£¨Èç¹ûϵͳÔÚCÅÌÔòΪC:\Program Files£©¡£
ÉèÖÃ Classpath
JDBC Çý¶¯³ÌÐò²¢Î´°üº¬ÔÚ Java SDK ÖС£Òò´Ë£¬Èç¹ûҪʹÓøÃÇý¶¯³ÌÐò£¬±ØÐ뽫 classpath ......