sql-server

Best Practices for updating multiple check boxes on a web form to a database

A sample case scenario - I have a form with one question and multiple answers as checkboxes, so you can choose more than one. Table for storing answers is as below: QuestionAnswers ( UserID int, QuestionID int, AnswerID int ) What is the best way of updating those answers to the database using a stored proc? At different jobs I'...

SQL Server getdate() to a string like "2009-12-20"

In Microsoft SQL Server 2005 and .NET 2.0, I want to convert the current date to a string of this format: "YYYY-MM-DD". For example, December 12th 2009 would become "2009-12-20". How do I do this in SQL. The context of this SQL statement in the table definiton. In other words, this is the default value. So when a new record is creat...

SQL Server 2008: Filtering Out Duplicate Rows Based on Multiple Columns

Hi, Thanks to everyone who helped me with my last question. This is a similar question, but now I have a better idea of what I want. Again I'm using MS SQL Server 2008, and I'm trying to figure out a query that is a little beyond my week of SQL experience. Right now I have the following simple query SELECT pl.val, pl.txt_val, pl.id FR...

TSQL: Why cannot use newid() inside a scalar-valued function

Hi folks: I try to implement the following link with a scalar-valued function, the SQL Server 2000 return an error msg: Invalid use of 'newid' within a function. http://www.bennadel.com/blog/310-Ask-Ben-Getting-A-Random-Date-From-A-Date-Range-In-SQL.htm Is there any way to get around this? ...

DotNetNuke C# version

Hi there, Is there a C# version of DotNetNuke? and how secure are this program to use for my companies intranet? Thanks in advance ...

q-gram approximate matching optimisations

Hi I have a table containing 3 million people records on which I want to perform fuzzy matching using q-grams (on surname for instance). I have created a table of 2-grams linking to this, but search performance is not great on this data volume (around 5 minutes). I basically have two questions: (1) Can you suggest any ways to improve p...

SQL atomic choose unused item from list and allocate to another table

I have a list of Channels. I need to use an available one of these if there is one and allocate it to a session. If no available ones are left over I need to create a new one and allocate it to the session, and let the calling routines know that it is a new Channel. I have the following implementation, which seems to work, but I was won...

Retrieve Last n number of records in SQL Server 2008

tblCurrent_locations Id BusNo Date Time 1 mh30q121 2009/12/18 11:00:00 2 mh30q121 2009/12/18 1245:30 3 mh30q121 2009/12/18 11:30:00 4 mh30q121 2009/12/18 1015:00 5 mh30q121 2009/12/18 11:00:00 6 mh30q121 2009/12/19 13:00:00 7 mh30q121 20...

VS 2008 Team Database project

I have one database of sql2008. 1- Some table are use for client in sql compact CE format. 2- Whole DB on server I want to use team data base project solution to manage, compare and modify the schema. Can i made any distinguish to project to compare only some tables and generate scripts. Please let me know if it make some sense. ...

Creating Stream DATABASE in a remote server

Whith the assistance of a very good fellow from this forum (Mr. DJHnz) i solve my first issue regarding the creation of a stream database Now i'm facing another issue I'm giving you the code: USE [master] GO /****** Object: StoredProcedure [dbo].[sp_AddStreamDB] Script Date: 12/21/2009 09:55:47 ******/ SET ANSI_NULLS ON GO SET QUO...

Search in multiple tables with Full-Text

Hi, I'm trying to make a detailed search with asp and SQL Server Full-text. When a keyword submitted, I need to search in multiple tables. For example, Table - Members member_id contact_name Table - Education member_id school_name My query; select mem.member_id, mem.contact_name, edu.member_id, edu.school_name from Members me...

Subtract all values from data

Table data look like this id val 1 4 2 2 3 1 I want result of subtract valu of val field in one sql statement. like it should be like 4-2-1 = 1 if order by id asc, 1-2-4 = -5 if order by id desc. ...

Connection pooling in .Net Sql Provider - when connection is closed

Hi, I just wonder after what duration .Net Sql Provider will close connection which is in pool? Thanks, Pawel ...

What is equivalent statement of DBCC INPUTBUFFER(@@SPID)(which give sql statement for current connection otr specified connection) in MYSQL?

What is the MySQL equivalent statement of DBCC INPUTBUFFER(@@SPID), which lists the sql statement for current connection or specified connection? ...

Why sleeping between each data request from database gives me better performance?

I have an application that query set of records from sql server 2008 database, the performance is good when there is sleep between each data request (set of queries) than without sleeping. The following is the pesudo code for my scenario: for i =1 to end GetData Process //adding sleep here gives better performance I have run the sql p...

Deleting records using a cursor

I have limited knowledge of SQL so can someone let me know if my thoughts are correct. I have a table that slowly fills up over time. I need to delete records from the first record to a given point in the table. As the primary key is based on GUIDs I am aware that I can’t do a delete easily because I can’t sort based on GUIDs (this was d...

Backup and Restore Filtered Data from SQL Server database using C#

Hello Friends, I wish to implement backup and restore feature for my application. Here I want to backup filtered data(not the whole database). Like Select * from Sales where CompanyId=1 For all tables in database and write these data to a file.bak file, later which I can be used for restore purpose. My Question here is Is...

Performance and monitoring .NET Apps

Hi, We've build a Web Application which is performing horrible even with alot of resources available. My boss doesn't believe me that the application is consuming alot of Hardware IO, so I have to prove that the hardware is ok, but the web app is really crap. The app is using: SQL Server 2000 with SP4 The main web application (.NET 3...

Regarding delete a record

HI I am having a table which does not have any primary key or unique key. How can I delete the duplicate records? Can any one of u tell me? ...

UTF-8 £ sign not rendering correctly

HTML is stored in the DB. £ sign is stored as £ and renders correctly in 1252 however when I change the page encoding to utf-8 renders incorrectly ? I know its a simple issue.. ? ...