sql-server

credentials questions

Hi, Let me explain briefly how the app is being setup (by the previous architect).. I have the following app: Server1 Server2 WPF app which installed on the client desktop WCF app which hosted on IIS in Server1 SQL server instance which installed on Server2 (with internal IP addr 10.111.3.10) WPF on client side calls the WCF service...

SQL query to find where no primary key exists

Hi I have re-added a foreign key relationship to a table in order to do so I had to abandon checking data on creation. I presume some parent(Company) objects have been deleted and I want to find the orphaned(Division) records. How would I find an row where the foreign key does not exist in the primary table? This is what I was thinking ...

How do you read a full table from a SQL database in VB.NET?

I hate to ask this question on this forum, but I'm having a lot of trouble finding it on these online tutorials. Basically, I'm learning about SQL, VB.NET, and how to glue the two together, and I've learned about using SqlCommand.executeScalar() to get the first entry in a table. But that's all it's really good for, right? Or is there...

List asp.net topics for interview

I am having 3 years of experience in asp.net. I need to list down topics that are related to web development I have listed the following topics. Please add your topics if in case i have missed A.OOPS Classes Objects Polymorphism Encapsulation Abstraction Inheritance Interface Abstract class / virtual cass Access Modifiers Overloading...

How do i create index column in sql?

I'm using SQL-Server 2005. I have table with many columns, rows i select have where clause which makes impossible to use identity as indexer. I want select all these row + indexer row (acting like identity). example 2 jack 4 thomas 8 james to 1 2 jack 2 4 thomas 3 8 james thanks ...

Check constraint for a flag column

Database is MS SQLServer Data example: | Name | defaultValue | value | | one | true | valone | | one | false | valtwo | | one | false | valthree | I'm after a way of constraining the table such that each 'Name' can only have one row with 'defaultValue' set to true ...

Does SQL Server automatically discard unnecessary joins?

If I submit a query to SQL Server 2005 which contains a number of LEFT JOIN clauses where the table joined to is then never referenced, will the joins still happen or is SQL Server intelligent enough to discard them? Obviously it wouldn't be able to discard INNER JOINs [false assumption! see answers] as that would potentially change the...

Getting data for more than 1 categories in SQL Server

There are some categories and its products. But products is used for another categories. For example, There are "metal handles" categories and it is used for "metal handles" but at the same time it is used for "children handles". I should say them that you belong to "metal handles" but you could be in "children handles" too How do I cre...

Test Function in MVC Project

So I want to test one of my Functions in my Web Project, but it's not actually connected to anything in the project yet (someone else is working on that part). The Function takes in an "ID" field, goes off and does some queries and gets some data, performs some calculations on it, and then writes a bunch of lines to a FileStream and retu...

How to get many rows based on several uniqueidentifiers?

I'm trying to make a select like this: DECLARE @ContentIDs VARCHAR(MAX); SELECT @ContentIDs = 'e28faa48-adea-484d-9d64-ba1e1c67eea3,8338A6DE-8CDF-4F52-99CE-62E2B107FF97' SELECT * FROM [Content] WHERE [ID] IN (@ContentIDs) It only returns the content with the first UNIQUEIDENTIFIER. How can I retrieve all rows? ...

SQL Server 2008 Cannot find the object

I've created a number of tables and stored procedures. There is a login that is assigned to a role that has execute permission. For all but 2 of the stored procedures, everything is working just fine. But, for 2 of them I get the following error: Msg 15151, Level 16, State 1, Procedure XX, Line 15 Cannot find the object 'XX', b...

generate schemas for sql 2008 xml bulk load

hey guys i have to import large sized xml data files (some of them 500 mb in size) into sql 2008. i plan to use sqlxml bulk load for the same. however i am only interested in certain elements of the xml data file, not each and every element. my question is: in the schema file do i need to mention each and every element present in the xm...

Why does my sql server database "full backup" not contain recent data?

I just migrated a SQL Server 2008 database while the sales staff went to lunch. I did a full backup and then copied the backup to the new server where I restored it to the new SQL Server installation. The staff got back from lunch and told me that a few of the recent deals they put in right before lunch were no longer showing up in the ...

Sending SMTP mail in SQL Server 2008 R2 Express

I tried using : sp_send_dbmail But I got the following error: Msg 15281, Level 16, State 1, Procedure sp_send_dbmail, Line 0 SQL Server blocked access to procedure 'dbo.sp_send_dbmail' of component 'Database Mail XPs' because this component is turned off as part of the security configuration for this server. A system...

Is it possible to specify the data source during execution of an SSRS report via the web service?

Hello all, I have a single server that hosts our production and development databases. It's running SQL Server 2008 (not R2) with SQL Server Reporting Services. I deploy a VS 2008 Reporting Services project to the server to provide the reports. All the reports use a single shared data source, currently pointing at the production databa...

How can i get the row number in sql query?

Hello, I think each row in sql server is given a unique number. How can i retrieve it in my sql query? Thanks in advance :) ...

Practice SQL Queries

Hi I wanted a website that has ample amount of SQL (SQL Server 2005 or 2008) related queries to practice at home Please let me know if you have any idea about the same. thanks ...

tsql identity insert without column name list

I am going to dump some data from one db to another one. I am using set identity_insert MyTable on GO INSERT INTO MyTable SELECT * FROM sourceDB.dbo.MyTable GO set identity_insert MyTable off Is anyway to get this to work? There's 30 tables and it will be time consuming to add the list of column names to the insert statement. I am usi...

How to delete completely duplicate rows

Hello, Say i have duplicate rows in my table and well my database design is of 3rd class :- Insert Into tblProduct (ProductId,ProductName,Description,Category) Values (1,'Cinthol','cosmetic soap','soap'); Insert Into tblProduct (ProductId,ProductName,Description,Category) Values (1,'Cinthol','cosmetic soap','soap'); Insert Into tblProd...

How to dispatch thousands of SQL requests asynchronously

We are writing a simple application: build thousands of SQL select statements run each select using BeginExecuteReader put the results into another database We've tried a few things that either leave connections in a SUSPENDED state (as verified by sp_who2), or take a much longer time to complete than just the SQL query itself (mayb...