sql-server-2014

SQL Server xp_delete_file parameters

半腔热情 提交于 2019-12-03 23:54:21
Who can explain list of xp_Delete_file parameters in sql server. I don't find msdn document for this stored procedure. I got script of xp_Delete_file from maintenance plan but didn't understand first parameter. Xp_delete_file take five parameters: File Type = 0 for backup files or 1 for report files. Folder Path = The folder to delete files. The path must end with a backslash "\". File Extension = This could be 'BAK' or 'TRN' or whatever you normally use. Date = The cutoff date for what files need to be deleted. Subfolder = 0 to ignore subfolders, 1 to delete files in subfolders. Source How to

SSIS and Informatica

允我心安 提交于 2019-12-03 21:58:16
SQL SERVER 2014 SSIS has been released,we have already got lot of facilities in SQL SERVER 2012 SSIS.Can anybody compare SSIS 2014/SSIS2012 with Informatica Power center ? What are the additional fetures are there in the Informatica new version than SSIS 2012/2014? Or are there functions in SSIS 2014/20122 ,which are not available in Informatica. I still can not understand why clients are investing in very expensive tools like Informatica,If we have reliable and effective tool like ssis. Experts Please have a discussion on this This would take some time to name all the differences. These

How to make JSON from SQL query in MS SQL 2014

廉价感情. 提交于 2019-12-03 12:43:56
Question: What is best solution to generate JSON from a SQL query in MS SQL 2014? I created a procedure, but it is very slow. My Example: DECLARE @customers xml; DECLARE @json NVARCHAR(max); SET @customers = (SELECT * FROM dbo.Customers FOR XML path, root) EXEC [dbo].[HTTP_JSON] @customers, @json EXEC [dbo].[HTTP_JSON](@Shopping) Create PROCEDURE [dbo].[HTTP_JSON] @parameters xml, @response NVARCHAR(max) OUTPUT WITH EXEC AS CALLER AS set @response = (SELECT Stuff( (SELECT * from (SELECT ', {'+ Stuff((SELECT ',"'+coalesce(b.c.value('local-name(.)', 'NVARCHAR(MAX)'),'')+'":"'+ b.c.value('text()

Azure SQL Database vs. MS SQL Server on Dedicated Machine

*爱你&永不变心* 提交于 2019-12-03 04:50:04
问题 I'm currently running an instance of MS SQL Server 2014 (12.1.4100.1) on a dedicated machine I rent for $270/month with the following specs: Intel Xeon E5-1660 processor (six physical 3.3ghz cores + hyperthreading + turbo->3.9ghz) 64 GB registered DDR3 ECC memory 240GB Intel SSD 45000 GB of bandwidth transfer I've been toying around with Azure SQL Database for a bit now, and have been entertaining the idea of switching over to their platform. I fired up an Azure SQL Database using their P2

Create function to split delimited seperated data for all records in the table [duplicate]

北城以北 提交于 2019-12-02 22:20:21
问题 This question already has answers here : Delimited Function in SQL to Split Data between semi-colon (2 answers) Turning a Comma Separated string into individual rows (14 answers) Closed 2 years ago . I have Input like this- select ID,FIELD from TABLE 1| A,B,C,D 2|X,Y,Z Output like this- SELECT ID,FIELD from TABLE 1|A 1|B 1|C 1|D 2|X 2|Y 2|Z Could someone please help me as how can I do it in SQL Server 2014 in an easy way ? 回答1: You can choose a string splitting function from Aaron Bertrand's

SQL , the error message appeared with foreign key constraint

时光怂恿深爱的人放手 提交于 2019-12-02 21:59:40
问题 IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'animal_vaccinations') DROP TABLE animal_vaccinations IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'animals') DROP TABLE animals IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'vaccine_codes') DROP TABLE vaccine_codes IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'intake_codes') DROP TABLE intake_codes go --1.2 CREATE TABLE: intake_codes create table

Flatten table rows into columns in SQL Server [duplicate]

痴心易碎 提交于 2019-12-02 18:51:46
问题 This question already has an answer here : Insert and update in a cursor in SQL Server (1 answer) Closed 11 months ago . I have the below SQL table which has the data generated randomly Code Data SL Payroll 22 SL Payroll 33 SL Payroll 43 .. ..... I want to transfer the data so the format becomes as shown below Code Data1 Data2 Data3 .. SL Payroll 22 33 43 .... Someone suggested Pivot table to transform the data as below SELECT Code, [22] Data1, [33] Data2, [43] Data3 FROM ( SELECT * FROM T )

SQL , the error message appeared with foreign key constraint

感情迁移 提交于 2019-12-02 13:13:36
IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'animal_vaccinations') DROP TABLE animal_vaccinations IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'animals') DROP TABLE animals IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'vaccine_codes') DROP TABLE vaccine_codes IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'intake_codes') DROP TABLE intake_codes go --1.2 CREATE TABLE: intake_codes create table intake_codes( intake_code varchar(1) not null , intake_desc varchar(200) not null) go -- 1.3 CREATE TABLE

How to use multiple columns in pivot?

可紊 提交于 2019-12-02 12:46:51
问题 I have this query SELECT [b].[BillID], [b].[BillingCode], [bc].[CurrentUsage], [bc].[Rate], [bc].[CurrentCost], [c].[Title] INTO #Temp FROM [dbo].[Bills] AS [b] INNER JOIN [dbo].[BillCosts] AS [bc] ON [bc].[BillIDRef] = [b].[BillID] INNER JOIN [Base].[Costs] AS [c] ON [c].[CostID] = [bc].[CostIDRef] this is result BillID BillingCode CurrentUsage Rate CurrentCost Title ----------- -------------------- ------------ ----------- ----------- ------ 5 44545455 10 20 30 AvgTimes 5 44545455 40 50 60

Cannot insert the value NULL into column where using Sql Select statement

流过昼夜 提交于 2019-12-02 11:52:26
Can you tell me how to avoid below mentioned exception ? INSERT INTO [Migrated].[dbo].[Cities] (Name, ZipCode) SELECT DISTINCT a.City, a.ZipCode FROM [Legacy].[dbo].[Ziplist] AS a WHERE (a.City IS NOT NULL AND a.ZipCode IS NOT NULL); Exception: Cannot insert the value NULL into column 'IsDeleted', table 'Migrated.dbo.Cities'; column does not allow nulls. INSERT fails. As @jamieD77 commented you are missing the IsDeleted column in your insert statement. The error means that the column is marked as "NOT NULL" and therefore a value must be inserted when a new row is created. So you either need to