sql-server

Are there any issues with connecting MS Access to a SQL Server database that I should be aware of?

I have an issue occurring in Microsoft Dynamics GP, and am doing research to see if this is the cause,but this could be a Access to SQL Server issue. GP stores data in SQL Server, and MS Access is being used to access the table data. Some data appears to be going missing in the production database. Unfortunately, I don't know what is bei...

Getting the application executable name from T-SQL stored procedure

From a stored procedure in SQL Server, is it possible to get the name of the executable (ie MyApp.exe) that owns the connection? I know there is APP_NAME(), but that appears to just return whatever string was passed into the 'Application Name' parameter in the connection string. If this is possible, how can it be done? Thanks. ...

Can I use SQL to find missing numbers in the example table I give below?

Let's say I have the following table with three columns: id | start_block | end_block ----------------------------- 01 | 00000000001 | 00000000005 02 | 00000000006 | 00000000011 03 | 00000000012 | 00000000018 04 | 00000000025 | 00000000031 05 | 00000000032 | 00000000043 Each row was a "Start Block" and an "End Block". If the data was...

Log changes to database table with trigger

I am looking for a good way to log changes that occur on a particular set of tables in my SQL Server 2005 database. I believe the best way to do this is through a trigger that get's executed on updates and deletes. Is there anyway to grab the actual statement that is being ran? Once I have the statement I can easily log it someplace else...

Shared SqlConnection

Is it good practice to have one shared SqlConnection object in a .NET application to use for all of your database connections or should you have a separate one each time you access the database? I currently have a shared one and seem to be running into issues all of a sudden. It seems like I can't use a shared one when I need to use SQL...

SQL read data from table in vb

I'm trying to get a single field back from the data. (I am searching by a primary key so I should get 0 or 1 answer). Please help. The table that I am querying has one entry with user = someone, input to several columns with the ans column having "a good answer" Code: Dim reader As SqlDataReader Dim par As SqlParameter Dim result As ...

Best UI control to create expandable report in ASP.NET?

I have a SQL Server table full of training course progress. I want to make a report. The report is to be a list of users where each row shows their name, completion status, and percentages. They are to be able to expand each row to show sub-rows which elaborate with section by section detailed stats. What is the best UI control to use in...

SQL Server - simple remote reporting tool?

I want to give a client access to a SQL server instance so they can execute a stored proc, or run a view, but ideally I don't want to give them SQL Server management studio as they are non technical. Are there any free and easy to use remote admin / reporting utilities for SQL Server? ...

Trigger that modifies multiple rows on diffrent table then it was invoked on in SQL Server 2005

I have tried to perform update on table which was trigger by update on other table and I got error message: The row value(s) updated or deleted either do not make the row unique or they alter multiple rows. For example I have this tables: table_1 =========== int id (primary_key,identity) nchar(10) state_name table_2 =========== in...

SubSonic, SQL Server and MySQL problems table names [ ClienteEndereco Clienteendereco ]

I was making tests with SubSonic with SQL Server and everything was fine. I decided to install MySQL and made the same tests, but now I have a little problem My table name is ClienteEndereco in SQL Server but when i make change in my web.config to work with MYSQL and recompile the program the table name comes Clienteendereco SQL Serve...

If I'm querying a database, how can I get the 5th row back from a given row?

If I have a row id and I want the 5th row back from that row how would I do this? Normally I could just go rowId - 5 and that would be the id of the 5th row back... However, I need to account for if a row has been deleted, this would mean that, for example 39, 40, 41, 42, 43, 44, 45 if rowId was 45, then I would get rowId of 40 fo...

Disable Sql 2008 caching?

I have application that makes different queries with different results so the caching in my case is harmful. This means there is no common data that sql may benifit from it to fetch the result from memory directly instead of making hard disk access. ...

Protect sensitive information from the DBA in SQL Server 2008

Our client need to encrypt the MOSS content database so the content db should not be able to view by DBA or unauthorized people without the right encryption key. Seem the Transparent Data Encryption (TDE) in SQL Server 2008 cannot protect the sensitive information from DBA cause TDE is designed to protect data 'at rest'. Does anyone her...

Visual Web Developer 2008 Express wanting SQL Server 2005 instead of 2008?

When I double click on an mdf file on Visual Web Developer 2008 (NerdDinner.mdf) it says: Connections to SQL Server files (*.mdf) require SQL Server Express 2005 to function properly. Please verify the installation of the component or download from the URL: http://go.microsoft.com/fwlink/?LinkId=49251 The URL of course points to SQL ...

How to import data to an in-memory database?

Are there any ways to import data in databases such as MS SQL, MySQL into in-memory databases like HSQLDB, H2 etc ? ...

Export DBML to SQL script

Due to a harddrive crash, I lost my SQL server database files for a project I was creating. I still have my DBML files I used in my .NET project, so I still have the database structure in a file. Is it possible to export my DBML somehow to a SQL server script, to recreate my databases in SQL server. ...

random values from db in c#

How can I retrive random random ItemIDs from the list of existing ItemIDs in ItemID column intge db, given below is the sqlcommand I've used. (SqlCommand RetrieveComm =new SqlCommand("SELECT * FROM item_k WHERE ItemID='" +intGetRequest+ "'", searchCon)) thanks, ...

Advanced (?) SQL Joins?

I am a bit lost as to how to explain this, so I will try to give an example of some tables (+ data) and then the result that I am after (all my table columns are NOT NULL): Table: Customers Id int primary key Name varchar(250) Table: Stats (Date, CustomerId is the primary key) Date (date) CustomerId (int) - foreign key to Customers t...

SQL Server 2008 T-SQL Join problem

Followed up by a new question, that contains the question as text, not as an image like this one: http://stackoverflow.com/questions/904209/sql-server-2008-t-sql-join-problem-ver-2/904450#904450 (This question is an image. Right click on "I have some table with value". :) The query should automaticly work if a new position record i...

SQL Server 2008 T-SQL Join problem ver 2

I have some table with data Category CategoryID CategoryName 1 Home 2 Contact 3 About Position PositionID PositionName 1 Main menu 2 Left menu 3 Right menu ...(new record can be added later) CategoryPosition CPID CID PID COrder 1 ...