sql-server-2005

developing SQL 2005 application using SQL 2008 server

半城伤御伤魂 提交于 2020-01-15 05:11:26
问题 I am developing an application for one of my customer who has SQL 2005 but I have SQL 2008 on my system. Can I develop my application using SQL 2008 and then ported it simply to SQL 2005? I will use EF and C# for my application and the SQL DB has database (no code). 回答1: Just install SQL Server 2005 express and use that At some point, developing an backward compatible app will come back to bite you because there are differences in data types, deprecated features, discontinued features, and

getting the range of a number column(min/max) if there are missing numbers in between

自古美人都是妖i 提交于 2020-01-15 04:53:29
问题 How would I query the range of a number column if the number ends somewhere then picks up again at a higher number? If I had a column like: Number ------- 1 2 3 4 5 11 12 13 How can I return a result like Min | Max ---------- 1 | 5 11 | 13 回答1: ;WITH CTE AS ( SELECT Number, Number - dense_rank() over (order by Number) grp FROM yourtable ) SELECT min(Number) min, max(Number) max FROM CTE GROUP BY grp FIDDLE 回答2: Try this: select t1.num, (select min(num) from table t3 where t3.num >= t1.num and

protecting sql server database file

白昼怎懂夜的黑 提交于 2020-01-15 03:46:22
问题 what is the recommendations should i do to prevent anyone from hacking or getting the sql server data base file (MDF File) ? Note : i use sql server 2005 回答1: Some simple recommendations: Do not expose access to your database server to the internet. It should be behind a firewall that only allows the web server to access it over a particular port (not the default). Do not allow remote desktop or any other type of similar access from external connections. For internal connections, ensure that

Retrieve previous version of a stored procedure

末鹿安然 提交于 2020-01-15 03:23:09
问题 I have modified a stored procedure today but after that I realized that it is wrong. So I want revert it back. Is there any way to get the previously modified stored procedure or else last date's stored procedure.I don't have any back up also. Thank you. 回答1: Not directly within SQL Server. Unless you have kept a script in source control or elsewhere your only option is to restore an older backup to another environment and script out the old version from that. 回答2: No, unless the SSMS query

Distinct Row values as Columns Sql Server

喜夏-厌秋 提交于 2020-01-15 01:50:36
问题 I have a temp table with 3 Columns Like below, JobID JobType JobValue 12 HR Jesica 23 MANAGER Ravi 5 MANAGER Jacob 60 EMPLOYEE Kiruan 45 MANAGER Abidam 27 HR Kamsura 21 MANAGER Chio Bin 87 EMPLOYEE Gamanya 22 HR Pradeep 56 HR Hari 67 EMPLOYEE Om 14 MANAGER Kiran My result table should be like JobID HR MANAGER EMPLOYEE 12 23 5 60 45 27 21 87 22 56 67 14 Jobvalue column values should come into result set. I have tried like below. Created a temp table with distict Jobtype row values. then using

Microsoft.ReportingServices.Interfaces.dll missing for SSRS 2005

喜你入骨 提交于 2020-01-14 19:51:31
问题 I am missing this DLL reference in c:\program files\SQL Server\90\Tools\Binn. I'm assuming that this is because I didn't install the 2005 client. I installed all of the services for 2005, the database instance, reporting services instance, SSAS and SSIS. I installed the 2008 client though, not the 2005 client, and 2008 database instance. So I assume it's because I didn't install the client, but does something else give me this DLL? Another install or a SDK or something? Thanks. 回答1: As a

How do I reference an alias in a WHERE clause?

浪尽此生 提交于 2020-01-14 13:43:09
问题 Here's my statement: SELECT C.Account, (RTRIM(N.FIRST) + ' ' + RTRIM(LTRIM(N.MIDDLE)) + ' ' + RTRIM(LTRIM(N.LAST)) + ' ' + LTRIM(N.SUFFIX)) AS OwnerName, DateAdd(dd, -1, C.ExpirationDate) as RealExpirationDate, C.Description, C.Type FROM CARD as C INNER JOIN NAME as N ON C.Account = N.Account WHERE (RealExpirationDate BETWEEN @StartDate AND @EndDate) AND C.Type IN(10,15,17,25) I keep getting an error saying that RealExpirationDate is an invalid column name. How can I reference that alias? 回答1

How do I reference an alias in a WHERE clause?

落花浮王杯 提交于 2020-01-14 13:42:12
问题 Here's my statement: SELECT C.Account, (RTRIM(N.FIRST) + ' ' + RTRIM(LTRIM(N.MIDDLE)) + ' ' + RTRIM(LTRIM(N.LAST)) + ' ' + LTRIM(N.SUFFIX)) AS OwnerName, DateAdd(dd, -1, C.ExpirationDate) as RealExpirationDate, C.Description, C.Type FROM CARD as C INNER JOIN NAME as N ON C.Account = N.Account WHERE (RealExpirationDate BETWEEN @StartDate AND @EndDate) AND C.Type IN(10,15,17,25) I keep getting an error saying that RealExpirationDate is an invalid column name. How can I reference that alias? 回答1

How should I modify this SQL statement?

走远了吗. 提交于 2020-01-14 13:29:19
问题 My SQL Server view SELECT geo.HyperLinks.CatID, geo.Tags.Tag, geo.HyperLinks.HyperLinksID FROM geo.HyperLinks LEFT OUTER JOIN geo.Tags INNER JOIN geo.TagsList ON geo.Tags.TagID = geo.TagsList.TagID ON geo.HyperLinks.HyperLinksID = geo.TagsList.HyperLinksID WHERE HyperLinksID = 1 returns these... HyperLinksID CatID Tags 1 2 Sport 1 2 Tennis 1 2 Golf How should I modify the above to have results like HyperLinksID CatID TagsInOneRowSeperatedWithSpaceCharacter 1 2 Sport Tennis Golf UPDATE: As

Why is insert trigger called when there is no data to insert?

南楼画角 提交于 2020-01-14 11:52:10
问题 I noticed a behavior which comes to me as a very wierd one. If I make an insert-select statement and the select part returns no data, the insert part still executes and even insert trigger is called (in insert trigger there is 0 rows in inserted pseudotable). Example: insert into table1 column1 select column1 from table2 where condition = 'Never met' Output: (0 row(s) affected) // 0 rows inserted (1 row(s) affected) // log from trigger May it be caused by 'universal' trigger (declared FOR