sql-server-2008

Would like help with LOGON Trigger

I've created a logon trigger in MS SQL that needs to check dm_exec_sessions for a login. This login is the user listed in the connection string and has owner right to the database. If the login is verified, I need it to update a specific table and send an email. So far I've done just the following piece and it disabled my web site. The ...

Anybody seen this behavior with Sql Server Reporting Services, a 64bit OS and an Oracle datasource?

I'm working on a Sql Server Reporting Services solution that queries across both a Sql Server data source and an Oracle 10g data source. My dev box is Windows 7 64bit with Sql Server 2008R2 and I'm hosting IIS7 and SSRS on that system for development; using VS.NET for designing the reports. I have been having errors when running the rep...

Should I commit or rollback a transaction that creates a temp table, reads, then deletes it?

To select information related to a list of hundreds of IDs... rather than make a huge select statement, I create temp table, insert the ids into it, join it with a table to select the rows matching the IDs, then delete the temp table. So this is essentially a read operation, with no permanent changes made to any persistent database tabl...

sql2008,sqldmo to sqlsmo

Hi! I previously was using SQL-DMO to automatically generate scripts from the database. Now I upgraded to SQL Server 2008 and I don’t want to use this feature anymore since Microsoft will be dropping this feature off. Now i want to convert the stored procedure below to 'sqlsmo' version Any answer is welcome. Thanks in advance. This i...

.Net best approach SQL Server 2008 incremental update based on up to date version

Assuming daily certain up to date database is produced via loading from various sources. Changes need to be applied to historical database based on uid, new records will added , non existing will be softly deleted , some will be updated. Is Ado.Net and Sql statements the most appropriate technology for the task like this ? ...

Query to get the names of all tables in SQL Server 2008 Database.

Is it possible to write a query that will give me the names of all the tables in an SQL Server database? I'm working on some 'after the fact' documentation on a system I didn't create and am looking for a shortcut to get a listing of the tables in a database. ...

Convert dependencies to point to View instead of Table

I currently have a SQL Server 2008 database in which I am planning to separate out some tables to other databases. I want to be able to replace all references to the separated tables from the original database using views. Is there a better way (other than manually changing all FK and SProc references) to switch all the dependencies to...

Child sProc cannot reference a Local temp table created in parent sProc

On our production SQL2000 instance, we have a database with hundreds of stored procedures, many of which use a technique of creating a #TEMP table "early" on in the code and then various inner stored procedures get EXECUTEd by this parent sProc. In SQL2000, the inner or "child" sProc have no problem INSERTing into #TEMP or SELECTing data...

Gridview Datasource Server error

I am developing a C# VS 2008 and SQL Server 2008 website. However, I get the below error now when I first run this: The DataSourceID of 'GridView1' must be the ID of a control of type IDataSource. A control with ID 'AdventureWorks3.mdf' could not be found What is causing this error? Here is my default.aspx file. I have configured...

Why SQL2008 debugger would NOT step into a certain child stored procedure

I'm encountering differences in T-SQL with SQL2008 (vs. SQL2000) that are leading me to dead-ends. I've verified that the technique of sharing #TEMP tables between a caller which CREATES the #TEMP and the child sProc which references it remain valid in SQL2008 See recent SO question. My core problem remains a critical "child" stored pro...

How to test if a SQL Server 2008 database can serve 200 concurent users

I have a SQL Server 2008 database in 3NF. I must check if the db can support many concurent users. Which is the best method ? Is there any free tool to do this ? Thank you very much. ...

How to display table in ASP.NET website?

I am developing a C# VS 2008 / SQL Server 2008 website, but now I cannot display the Gridview containing my table. I included the Default.aspx and aspx.cs files below. What do I need to do to fix this? I am not getting any errors now; just that this grid does not show up. Thanks! ASPX file: <%@ Page Language="C#" MasterPageFile="~/...

Type '_Default' already contains a definition

I am developing a C# VS 2008 / SQL Server 2008 website. I have a Gridview. I included the Default.aspx and aspx.cs files below. But when I build this I get the below error: The Type '_Default' already contains a definition for 'btnOWrite' What do I need to do to fix this? I am not getting any errors now; just that this grid does...

Could not load type 'Default.DataMatch' in DataMatch.aspx file

I am developing a C# VS 2008 / SQL Server 2008 website, but now I am getting the above error when I build it. I included the Default.aspx, Default.aspx.cs, DataMatch.aspx, and DataMatch.aspx.cs files below. What do I need to do to fix this? Default.aspx: <%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" C...

How to load a type in parent-child website

I am developing a C# VS 2008 / SQL Server 2008 website. Although this same code compiles in the Project version, the website version does not compile. Many of their files are the same so I do not understand even where to look. The only compile error I get is: Could not load type 'DataMatch' in my DataMatch.aspx file. Is the problem...

SQL Server indexed view matching of views with joins not working

Does anyone have experience of when SQL Servr 2008 R2 is able to automatically match indexed view (also known as materialized views) that contain joins to a query? for example the view select dbo.Orders.Date, dbo.OrderDetails.ProductID from dbo.OrderDetails join dbo.Orders on dbo.OrderDetails.OrderID = dbo.Orders.ID cannot be automat...

suitable data type to save string larger than 8000 charachter

what is the suitable data type to save string more than 8000 character in SQL database? ...

Which non-clustered index should I use?

Here I am studying nonclustered indexes on SQL Server Management Studio. I've created a table with more than 1 million records. This table has a primary key. CREATE TABLE [dbo].[Customers]( [CustomerId] [int] IDENTITY(1,1) NOT NULL, [CustomerName] [varchar](100) NOT NULL, [Deleted] [bit] NOT NULL, [Active] [bit] NOT N...

SQL SERVER FULL-TEXT INDEX, CONTAINS return empty

Hi, All: I got a issue about full index, any body can help me on this? 1) set up full text index CREATE FULLTEXT INDEX ON dbo.Companies(my table name) ( CompanyName(colum of my table) Language 0X0 ) KEY INDEX IX_Companies_CompanyAlias ON QuestionsDB WITH CHANGE_TRACKING AUTO GO 2) Using CONTAINS to find the matched rows SELECT Co...

Appropriate SQL Server Permissions for Developers

After a couple of Google searches and a quick look at questions here, I cannot seem to find what I thought would be a cookbook answer for SQL Server permissions. As I often see in small shops, most developers here were using an admin account for SQL Server while developing. I want to set up roles and permissions that I can assign to de...