sql-server-2008-r2

bulk insert a date in YYYYMM format to date field in MS SQL table

有些话、适合烂在心里 提交于 2020-01-10 05:47:06
问题 I have a large text file (more than 300 million records). There is a field containing date in YYYYMM format. Target field is of date type and I'm using MS SQL 2008 R2 server. Due to huge amount of data I'd prefer to use bulk insert. Here's what I've already done: bulk insert Tabela_5 from 'c:\users\...\table5.csv' with ( rowterminator = '\n', fieldterminator = ',', tablock ) select * from Tabela_5 201206 in file turns out to be 2020-12-06 on server, whereas I'd like it to be 2012-06-01 (I don

Passing dynamic order by in stored procedure

陌路散爱 提交于 2020-01-09 19:30:51
问题 I am creating below stored procedure. declare @PageNum as Int declare @PerPageResult as Int declare @StartDate as varchar(25) declare @EndDate as varchar(25) declare @SortType as Varchar(50) declare @SortDirection as Varchar(4) set @PageNum=1 set @PerPageResult=20 set @StartDate='2008-02-08' set @EndDate='2015-02-08' set @SortType='RegDate' set @SortDirection='Desc' declare @Temp Table(RowNum int, RegDate Date, Registered int, Female int, Male int, [Join] int, Rebill int, TotalPointsEarned

Open XML document and return for every row, based on row's path to xml file

Deadly 提交于 2020-01-09 11:54:08
问题 I'm pretty new to using XML with TSQL, and recently ran into an issue that I can't think around and need your help with. Scenario: I have a query built that returns quite a few columns, one of which contains a UNC path to an .xml file. For simplicity's sake, lets just say there's 2 columns: GUID, filePath Example values: GUID | filePath 0001 | \\server\folder\file1.xml 0002 | \\server\folder\file2.xml 0003 | \\server\folder\file3.xml Goal: There are three field values in each xml file that I

Alias names to with rollup in SQL queries?

為{幸葍}努か 提交于 2020-01-09 11:05:28
问题 I am using with rollup in my sql query. I am not getting alias name for rollup. My SQL is SELECT [Column1], sum([Column2]) FROM Tablea GROUP BY [Column2] WITH ROLLUP Which returns s 8 t 8 j 8 null 24 How can I replace the NULL in the total row? 回答1: You can use the GROUPING function in a CASE expression. SELECT CASE WHEN GROUPING([Column1]) = 1 THEN 'Total' ELSE [Column1] END [Column1], sum([Column2]) FROM Tablea GROUP BY [Column1] WITH ROLLUP SQL Fiddle 回答2: select isnull([column1],'rollup')

SQLCLR using the wrong version of the .NET Framework

风格不统一 提交于 2020-01-09 07:13:09
问题 During a recent restart of our development server the SQL Server started using .NET 4.0 for the SQLCLR. This means that nothing using the CLR in SQL works, or at least that's my understanding by reading these sources: http://software.intel.com/en-us/blogs/2009/10/16/sql-server-2008-sqlclr-net-framework-version/ www.sqlskills.com/BLOGS/BOBB/post/On-SQL-Server-and-NET-40.aspx All we get are error messages of this type: Msg 6517, Level 16, State 1, Line 1 Failed to create AppDomain "xxx.dbo[ddl]

How to get exact character diff between two string in sql

為{幸葍}努か 提交于 2020-01-07 09:24:31
问题 I have two strings, I want to get difference between contents of two strings in SQL ?? for example, Declare @String1 as varchar(100)='Please check requirement and let me know your feedback.'; Declare @String2 as varchar(100)='Please checkout requirement & let me know your feedback'; Result should be like the words which are not common in both the string. e.g checkout , & 回答1: This code will first split the strings into single words and then check for words which do not exist in the other

Nested Cursor based update

烈酒焚心 提交于 2020-01-07 06:36:47
问题 So this is for a SSRS report so I'm using temp tables. I have two tables, one for transactions that I'm just using it to pull the account and the amounts. The second is amortized delinquency information I'm trying to adjust based on the transaction but I'm running into syntax issues. Are case statements not allowed to be used with cursors or updates? --Example Transaction:Account 123456 Principal 500.00 Interest 250.00 delinquent 5 months of 200 principal each month, the transaction had

On submit click getting issue in umbraco

女生的网名这么多〃 提交于 2020-01-07 02:45:06
问题 I have one submit click on which the comment get submitted for particular product or thing but on clicking that I am not able to submit that commnet and facing issue as seen in below images Another thing is that this things are working properly in my local host but when I upload it on my beta/staging/Live server I am facing this issue. I have also tried deleting umbraco.config file and log file but still facing same issue Also on log file I can see the issue as I have one issue for what i

SSRS Issues with 32bit and 64bit ODBC drivers

痞子三分冷 提交于 2020-01-06 21:04:44
问题 The ultimate goal is for users to be able to run a report that looks pretty and grabs current information from our database. We'd like to use SQL Report Builder since we're already using it for other reports. The database is Cisco UCCX and we're accessing it with an ODBC connection from our reporting services SQL Server 2008 R2. We've successfully setup System ODBC connections with both 64bit and 32bit drivers. When trying to access the connections though, we're receiving errors. Using the

ADODB Connection String not working in Classic ASP

两盒软妹~` 提交于 2020-01-06 20:37:18
问题 I have been developing an ASP.NET application. I want to integrate Classic ASP file(.asp) in this application. In a .asp file I have to fetch data from SQL Server 2008 r2 database. For this I have created db and rs object. I have passed ConnectionString in db.Open function. But I am getting no output for this code. Following is my code set db = Server.CreateObject("ADODB.Connection") db.Open "provider=SQLNCLI10;Data Source=HP-PC\SQLEXPRESS;Initial Catalog=RMToday;Persist Security Info=True;"