Ò»²½Ò»²½Ñ§Linq to sql£¨ËÄ£©£º²éѯ¾ä·¨
select
ÃèÊö£º²éѯ¹Ë¿ÍµÄ¹«Ë¾Ãû¡¢µØÖ·ÐÅÏ¢
²éѯ¾ä·¨£º
var ¹¹½¨ÄäÃûÀàÐÍ1 = from c in ctx.Customers
select new
{
¹«Ë¾Ãû = c.CompanyName,
µØÖ· = c.Address
};
¶ÔÓ¦SQL£º
SELECT [t0].[CompanyName], [t0].[Address]
from [dbo].[Customers] AS [t0]
ÃèÊö£º²éѯְԱµÄÐÕÃûºÍ¹ÍÓÃÄê·Ý
²éѯ¾ä·¨£º
var ¹¹½¨ÄäÃûÀàÐÍ2 = from emp in ctx.Employees
select new
{
ÐÕÃû = emp.LastName + emp.FirstName,
¹ÍÓÃÄê = emp.HireDate.Value.Year
};
¶ÔÓ¦SQL£º
SELECT [t0
Ïà¹ØÎĵµ£º
ΪʲôÐèÒªÊý¾ÝѹËõ
¡¡¡¡Ê×ÏÈ¿ÉÄÜÐèÒªÌÖÂÛµÄÎÊÌâ¾ÍÊÇΪʲôÔÚ´æ´¢³É±¾²»¶Ï½µµÍµÄ½ñÌ죬΢Èí»¹ÒªÉ··Ñ¿àÐĵØÔÚSQL ServerÖÐʵÏÖ²¢ÇÒ²»¶Ï¸Ä½øÊý¾ÝѹËõ¼¼ÊõÄØ?
¡¡¡¡¾¡¹Ü´æ´¢³É±¾ÒѾ²»ÔÙÊÇ´«Í³ÒâÒåÉϵÄÊ×Òª¿¼ÂÇÒòËØ£¬µ«ÊÇÕâ²¢²»´ú±íÊý¾Ý¿â³ß´ç²»ÊÇÒ»¸öÎÊÌ⣬ÒòΪÊý¾Ý¿â³ß´ç³ýÁË»áÓ°Ïìµ½´æ´¢³É±¾Ö®Í⣬»¹¼«´óµØ¹ØÁªµ½¹ÜÀí³É±¾º ......
Êý¾Ý¿â£º
1¡¢ ´´½¨Êý¾Ý¿âµÄÓï·¨£º
if exists (select * from sysdatabases where name='DT_name') /*ÅжÏÊÇ·ñ´æÔÚ£¬ÊÇÔòɾ³ý*/
drop database DT_name
create database database_name
on primary /* Ö¸¶¨Ö÷ÒªÎļþ×飬ÆäÖеÚÒ»¸öÖ÷ÒªÎļþ * ......
Ïò¸ßÊÖÇë½ÌÒ»¸öÎÊÌâ:
µ±ÎÒÖ´ÐÐ:
use master
exec xp_cmdshell 'osql /S musqlserver /U sa /P mypwd /d haodb /Q "select top 10 * from trandetail" /o C:\my1.xls'
ÒÔÉÏÖ´Ðгɹ¦,»á²úÉúÐÂÎļþ:C:\my1.xls'
È»ºóÎÒÏ뽫´ËÎļþÖ±½Ócopyµ½Áíһ̨µçÄÔÖÐ[Òѽ¨Á¬½Ó]
Ö´ÐÐ
......
½«ÁÐת»»ÎªÐУ¬Ï൱ÓÚ½«±í½á¹¹Ðýת90¶È
T_Student ±í
Stud_ID
Sex
Name
1
ÄÐ
Tom
2
Å®
Anne
3
ÄÐ
Jack
Ö´ÐÐ: Exec proColumnToRow ’T_Student’,’Name’,’ New_ID’
ת»»ºóµÄ±í
New_ID
Tom
Anne
Jack
Stud_ID
1
2
3
Sex
ÄÐ
Å®
ÄÐ
& ......
ÏÂÃæÌá³öÁË10ÌõºÍDB2 SQLÐÔÄÜÏà¹ØµÄ10ÌõÒòËØ£º
1¡¢ÌṩÊʵ±µÄͳ¼ÆÐÅÏ¢
¶ÔDB2ÓÅ»¯¹ÜÀíÆ÷£¨otimizer£©¶øÑÔ£¬ÈçºÎ¸ü¼ÓÓÐЧµÄÖ´ÐÐSQLÓï¾äÊÇÓÉ´æÔÚÓÚDB2 catalogÖеÄͳ¼ÆÐÅÏ¢¾ö¶¨µÄ£¬ÓÅ»¯Æ÷ÀûÓÃÕâЩÐÅÏ¢¾ö¶¨×îÓÅ»¯µÄ·¾¶¡£
Òò´Ë£¬ÎªÁ˱£³ÖϵͳÄܹ»×ö³ö×î¼ÑÑ¡Ôñ£¬ÐèÒª¾³£µÄÔËÐÐRunstatsÃüÁÀ´±£³Öϵͳͳ¼ÆÐÅÏ¢µÄ¼°Ê±ÓÐЧ¡£ ......