Решение: Сама функция: CREATE FUNCTION SalesByStore (@id int) RETURNS TABLE AS RETURN (SELECT * FROM bsh_products WHERE partID=@id) Вызов: ALTER…
Решение: sp_columns 'as_menuRoles' SELECT * FROM syscolumns sc JOIN sysobjects so ON sc.id = so.id WHERE so.Name = 'as_menuRoles' select…
Решение: db.ExecuteStoreCommand(string.Format(@" BULK INSERT [{1}] FROM '{0}' WITH ( DATAFILETYPE = 'widechar', FIELDTERMINATOR = '|', ROWTERMINATOR = '\n' );", p,tablename)…
Решение: db.ExecuteStoreCommand(string.Format(@" BULK INSERT [{1}] FROM '{0}' WITH ( DATAFILETYPE = 'widechar', FIELDTERMINATOR = '|', ROWTERMINATOR = '\n' );", p,tablename)…
Решение: использование SET IDENTITY_INSERT testIdentity ON; USAGE-HOW-TO: CREATE TABLE testIdentity (id int IDENTITY (1,1), name nvarchar(100)); INSERT INTO testIdentity(name) VALUES…
Решение: SELECT od2.ProductID, COUNT(od2.ProductID) AS Rank FROM OrderDetail od1 JOIN OrderDetail od2 ON od1.OrderID = od2.OrderID WHERE od1.ProductID = 4…
Решение: SELECT Col1, Col2, CASE WHEN Col1='AAA' THEN Col2 WHEN Col1='BBB' THEN Col2*2 ELSE NULL END AS Col3 FROM ...…
Решение: Restore HEADERONLY From Disk='C:\temp\topticket.bak' RESTORE DATABASE rudenAS FROM DISK = 'C:\temp\topticket.bak' WITH REPLACE, MOVE 'topticket' TO 'C:\DBs\rudenAS.mdf', -- путь…
Решение: использовать output declare @ordID int DECLARE @MyNewIdentityValues table(myidvalues int) insert into attr107(objectClassID, p541, p542, p545) output inserted.ObjectID into @MyNewIdentityValues…