sql-server-2005

How I can use a function which returns a table in a select statement with an inner join?

I need to use a function which returns a table, in a inner join sentence passing a parameter. When executed, the sentence like this is not working. SELECT T0.Code,T0.Data1,T0,Data2 FROM [dbo].[FNGet_Data] (T1.Code,'2010-01','USD') T0 INNER JOIN Codes T1 ON T1.Code=T0.Code When executed the sentence using a constant parameter works...

SQL Server - what is the size of my database if this is the output from sp_spaceused

I ran the command: EXEC sp_spaceused The output was: So what is the size of my database? Is it - 4768.25 - 4076.57 = 691.68 MB (1st table) OR 19896 KB (2nd table)? EDIT I'm using SQL Server 2005 Express which has a "database size" limit of 4 GB. So in this context of "database size", if I were to calculate how far up to the spa...

Is NOLOCK the default for SELECT statements in SQL Server 2005?

I have only SQL Server 2008R2 installed though I need to communicate with customers having 2005. [1] tells: "NOLOCK This does not lock any object. This is the default for SELECT operations. It does not apply to INSERT, UPDATE, and DELETE statements" [2] doesn't seem to mention it, but my checking in SSMS/SS 2008R2 shows that n...

Convert string id of column to int autoincrement

Hi, I have table Cars Id nvarchar(25) PK Name nvarchar(max) And there is some records. Id Name CodeXYZ Namezxc CodeQAZ Nameasd CodeEDC Nameqwe I want to convert Id column to int autoincrement: Id Name 1 Namezxc 2 Nameasd 3 Nameqwe but I have no idea how to make it :/ Could you help me ? ...

How should i start troubleshooting Check Database Intergrity job Failure?

I have a scheduled Check Database Intergrity maintenance plan in sql agent. Every time it completes, i get an email and it has always succeded until now. This time the status in the email is "Failed". I have tried to excute the job manually in management studio and again it failes. I now want to investigate and find out why and get issue...

Can a Check constraint relate to another table?

Let´s say I have one table called ProjectTimeSpan (which I haven´t, just as example!) containing the columns StartDate and EndDate. And that I have another table called SubProjectTimeSpan, also containing columns called StartDate and EndDate, where I would like to set a Check constraint that makes it impossible to set StartDate and EndD...

Problem installing SQL Server on Win 7 with Visual Studio

I have Windows 7 box. I want to install SQL Server 2005 on it. The box has following programs already installed: Visual Studio 2005 Visual Studio 2008 Visual Studio 2010 I had SQL server 2008 which I uninstalled. When I try to install SQL Server 2005, I get the following warning message: If I click on "Check for solutions online"...

SQL Server Pivot Table Help

I'm trying to turn the following ResultSet Meetings Covers Date TypeName 1 3 2010-10-14 Breakfast 1 1 2010-10-14 LunchCooked 2 4 2010-10-15 Breakfast 1 3 2010-10-18 Breakfast 1 3 2010-10-19 Breakfast 1 1 2010-10-19 LunchSandwich 1 ...

Temp table with converted values

I want script to convert my table CREATE TABLE #TempTable ( Code nvarchar(5) primary key, name nvarchar(100) ) Insert into #TempTable (Code ,name) Select st.Code , st.name From StaticTable st But there is something I must change. Code must be autoincremented from 100 Where length of code is more than 3, then I want insert there i...

FULLTEXT search with a multi-language column

Is there a way to use FULLTEXT in a multi-language table without giving each language its own column? I have one column I need to search, but the language in that column varies: ProductID int Description nvarchar(max) Language char(2) Language can be one of: en, de, it, kr, th Currently I build a concordance and use that for...

SQL Server 2005 derived field w/ logic

i have three tables Pproject, ProjectMilestone and ReleaseSchedule. i want to add a derived field to the project table called EndDate. the value of this new field called EndDate should be the larger of the two values ProjectMilestone.EndDate and ReleaseSchedule.EndDate. the SQL logic to get the two data points of EndDate within both t...

Need help for SQL select query for this two table

Table Capture image : http://img844.imageshack.us/img844/6213/99730337.jpg ------------ PositionTable------------ ID ContentFK Position 11 100 1 12 101 1 13 104 2 14 102 2 15 103 2 16 105 3 17 106 3 18 1...

Are there more efficient alternatives to ASP.NET 2.0 anonymous Profiles?

I discovered ASP.NET profiles a few years back and found it quick and easy to implement some powerful functionality in my web site. I ended up exclusively using "anonymous" profile properties because I am NOT using ASP.NET membership and wanted to track information and provide personalization for my site's users even though they weren't ...

Basic management scipts that you run in your database / instance?

What kind of basic management/audit scripts do you run in your databases or in an instance? There may be lots of them, but I would like to know (get hints) what kind of task would be most valuable when managing databases or an instance. And also what kind of reporting do you have from your databases (in a management perspective)? ...

What does "materializing" temporary table mean?

I have noticed quite a few mentions of the word "materializing" when people are talking about using temporary tables in SQL Server. Can someone expand on what it is that means? I am just trying to get a better understanding of what that means in terms of using temp tables? Thanks! S ...

Why am I getting this error "Internal connection fatal error" in only one of my stored procedures?

This issue is similiar to here. http://stackoverflow.com/questions/1155263/what-causes-internal-connection-fatal-errors Except it's only happening on one stored procedure and is happening all of the time and is only happening when I access this stored procedure from my website. I've even ran the stored procedure in SQL Server and it s...

SQL - Insert query Inside another Insert with updated Identity seed

I have 2 tables T1 AND T2 T1 has 10 unique records with a primary key (Identity Seed) T2 has multiple entires with Foreign Key for each record in T1 T1 has 2 columns : PrimaryKey - DATA T2 has 2 columns : PrimaryKey - FoeignKey (this FK is the Primary Key of T1) I need to write a query which will select all the records from T1 and INS...

SQL Server query help... need to convert varchar to date

Hi All, I am writing a query to fetch results for all the values in a column which is of varchar type.. are less than '29/08/2010' (date) My Query: SELECT * FROM EMPLOYEES WHERE COLUMN1 < '29/08/2010' Here the column1 is of varchar type. I am using SQL Server 2005 Is there a way to make this possible..?? Pls help me. Thanks in ad...

FTP Connection string using expression in SSIS

Hi, In my SSIS 2005 package, I need to give the FTP Connectionstring via an expression as I need to keep it configurable for the user from the dtsConfig file. At the moment I tried giving the following expression: Connectionstring = @[User::FTPServer] + "." + @[User::FTPUser] + "." + @[User::FTPPass] For this unique syntax, I took poi...

Select top record from group

How to from this table Name Code ABC Code1 DEF Code1 GHI Code2 JKL Code2 OMN Code3 get this result: Name Code ABC Code1 GHI Code2 OMN Code3 Is there any simple solution? ...