sql-server-2005

SQL Server 2005 - Reaching Table Row Size Limit

假装没事ソ 提交于 2019-12-14 04:18:40
问题 Is there a clean way to determine the row size of a table before adding a new column to it and not go over the 8060 byte limit? For example, if the table row length is currently 8055 bytes, and I want to add a datetime (8 bytes) this will go over as it will go to 8063 bytes (excluding the null mapping). However, if I add an integer (4 bytes), this will give it 8059 bytes, which fits inside the table size (excluding the null mapping). I am currently able to get the size of the table, however I

incorrect syntax near the keyword 'AS'

天大地大妈咪最大 提交于 2019-12-14 04:17:48
问题 Why do i receive a syntax error as such: Incorrect syntax near the keyword 'AS' I am using microsoft visual studio 2005 and sql server 2005 string strSql = "SELECT a.MCode, a.NameOfModule, a.Mod_Abbreviation, dt.ModuleCode, dt.Course, dt.Stage, dt.ModuleGrpFrom, dt.ModuleGrpTo, dt.GrpName, dt.GrpType, dt.StaffID, dt.AcadYear, dt.AcadSemester, dt.TotalHour, dt.WeeklyLectHr, dt.WeeklyPractHr, dt.WeeklyTutHr, dt.ModuleLeader, 0 AS TotalTeach, '' AS ModuleGroups, '' AS ML, 0 AS L, 0 AS P, 0 AS T,

Why does Entity Framework with Windows Authentication not pass my credentials to SQL Server?

醉酒当歌 提交于 2019-12-14 04:10:41
问题 I'm trying to get an MVC 4 intranet site with Entity Framework 5 working on web server running IIS6 but Windows Authentication/Integrated Security is not working right because the error says Stack Trace: [SqlException (0x80131904): Login failed for user 'EASTDOMAIN\WEBDEV2$'.] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5104926 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +260 System.Data.SqlClient.TdsParser.Run

how to convert date in English and French

邮差的信 提交于 2019-12-14 04:08:22
问题 I am trying to store formatted display dates in my tables. For example, I have a date as 20150621 and I want it as June 21, 2015 and 21 juin 2015 (for French). I have a query: convert(varchar(12),cast([datecolumn]) as datetime),107) This outputs: Jun 21,2015 , but I need June 21,2015 and also French date. I am using Sql 2005, so format doesn`t work in it. 回答1: Write as: SELECT DATENAME(MM, CAST([datecolumn] AS DATETIME)) + RIGHT(CONVERT(VARCHAR(12), GETDATE(), 107), 9) AS [Month DD, YYYY]

What caused a Private Bytes on SQL Server 2005?

十年热恋 提交于 2019-12-14 03:57:55
问题 My Server is Windows 2003 and SQL Server 2005 Standard. 3 GB of RAM. After run my client program for a while a Private Bytes up to 1.7 GB and never come down. only process 51 with status "runnable". Click details. create table #tmpDBCCinputbuffer ( [Event Type] nvarchar(512), [Parameters] int, [EventInfo] nvarchar(512)) insert into #tmpDBCCinputbuffer exec ('DBCC INPUTBUFFER(51)') select [Event Info] from #tmpDBCCinputbuffer Call connections have been closed. Any clue? 回答1: 1.7GB is the 2GB

Ternary operator in SQL? “invalid length parameter passed to the LEFT or SUBSTRING function”

旧巷老猫 提交于 2019-12-14 03:56:43
问题 Sorry for this misleading subject, i didn't know how to word better. Because i'm mainly a software-developer, the ternary operator comes to my mind with my following problem. I need to find the most robust way to link two tables via nullable foreign-key( modModel and tabSparePart ). The only similarity between both is the model's name and the sparepart's description(the tabSparePart is an external table from customer that is imported automatically, so it's not my responsibility and i cannot

With SQL can you use a sub-query in a WHERE LIKE clause?

血红的双手。 提交于 2019-12-14 03:53:17
问题 I'm not even sure how to even phrase this as it sounds weird conceptually, but I'll give it a try. Basically I'm looking for a way to create a query that is essentially a WHERE IN LIKE SELECT statement. As an example, if I wanted to find all user records with a hotmail.com email address, I could do something like: SELECT UserEmail FROM Users WHERE (UserEmail LIKE '%hotmail.com') But what if I wanted to use a subquery as the matching criteria? Something like this: SELECT UserEmail FROM Users

T-SQL Query That Returns lower case Results Only

≡放荡痞女 提交于 2019-12-14 03:45:00
问题 I have a table named "KEYWORDS" with a column named "ENTRY" of VARCHAR(10). Would it be possible to retrieve only the lower-case entries from that table? For example, the table might look like this: ENTRY =========== SearchString Searchstring searchstring SEARCHSTRING And I would like to be able to run a query that looks similar to: SELECT ENTRY FROM KEYWORDS WHERE ENTRY <condition to retun only the lowercase entry> where the result of the above would be: searchstring And if that can be done,

Looking for a good Bulk Insert XML Shredding example for SQL 2005

旧城冷巷雨未停 提交于 2019-12-14 03:42:58
问题 A little help needed. I'm receiving an xml file similar to this: <?xml version="1.0" encoding="utf-16"?> <dc:GRANTEE xsi:schemaLocation="http://www.blahblahblah.com/FullSchema test.xsd " xmlns:dc="http://www.blahblahblah.com/FullSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <RPGID>90CU0024</RPGID> <PLANID>01</PLANID> <CASE> <CASEID>100001</CASEID> <RPGID>90CU0024</RPGID> <FILE_O>2008-02-08T00:00:00</FILE_O> <ADULT> <ADULTID>100001A1</ADULTID> <CASEID>100001</CASEID> <APRIMARY

Fastest way for this query (What is the best strategy) given a date range

时光怂恿深爱的人放手 提交于 2019-12-14 03:39:29
问题 I have a table A that has a startDate and an end dateDate as 2 datetime columns besides some more other columns. I have another table B that has one datetime column call it dates column. This is in SQL Server 2005. Here the question: How to best set up the indexes etc to get the following: select .... from A , B where A.startDate >= B.dates and A.endDate < B.dates Both tables have several thousand records. 回答1: Update: See this article in my blog for efficient indexing strategy for your query