sql-server

SQL Server - Finding the Highest Priority item using Bitwise operators

The Problem: I want to return all of the rows from the Primary Data table together with the Highest Priority Exception based on the currently assigned Priority in an Exception table. I have created a simplified example of my data set-up below (with creation scripts) so hopefully you can help with what should be a fairly quick T-SQL pr...

Export SQL Server Database to Access using entity framework

Is it possible to export a sql server database (2008) to a new access database using the Entity framework (or anything else for that matter in code)? I have developed a desktop facing application that connects to a sql sever on a server and my client wants to be able to take snapshots of the database in access to send to people who do...

Storing PDF files as binary objects in SQL Server, yes or no?

I have to find a design decision for the following task: I have a SQL Server database and it contains a table of orders. PDF documents will be uploaded by users through a simple file upload from a web page and assigned to an order. There is not more than one document per order (perhaps no document, never more than one). For this purpose...

SQL Server 2008: Varchar Conversion to Numeric Data Overflow, Probably Because Some Are Ranges

I'm working on a query with a varchar column called ALCOHOL_OZ_PER_WK. Part of the query includes: where e.ALCOHOL_OZ_PER_WK >= 14 and get the errors: Arithmetic overflow error converting varchar to data type numeric. and: Error converting data type varchar to numeric. Looking into the values actually stored in the column, the larg...

Tips on how to improve full text search for search engine

I'm developing: http://www.buscatiendas.com.mx I've seen people entering text for queries with lots of typos. What kind of search could i implement so similar words are found? Like google does more or less would be neat. I'm using SQL Server Full Text search. ...

SQL Server and regular expressions

Hello ! Which will be better among following option ? Regular-expressions in SQL Server searches, as new versions support CLR objects ? Full text search ? Lucene.net combined with SQL Server ? Our database will be having millions and millions of records and we will be providing Google-like search option, and like Google sea...

Best practice to create (on demand) SQL Server 2008 Express databases in C#?

Hi all. The purpose is to handle the user's data (you can call them project, document, file, or whatever) in a brand new SQL Server 2008 Express database. The data are expected to occupy much less space than the 4GB available with the express edition (which is also free to distribute). E.g., each time the user selects File->New command...

How to run SP in sql server after every 1 hour ?

I have a table on which i want to perform some operations after every hour. For this I created a Stored Procedure but dont know how to call it after every hour. I know their are some kind of scheduled jobs but how to use them. Is it their some kind of service also that keeps on running continously every second where i can place my piec...

group by sql statement

so i got this statement, which works fine: SELECT MAX(patient_history_date_bio) AS med_date, medication_name FROM biological WHERE patient_id = 12) GROUP BY medication_name but, I would like to have the corresponding medication_dose also. So I type this up SELECT MAX(patient_history_date_bio) AS med_date, medication_name, ...

Using T-SQL to Query a File System Folder

Is it possible to query a folder in TSQL, from SQL Management Studio, and return a list of file names? If so, how? ...

deploy a reports project

I have a ReportsApplication and a WpfApplication. I Want Deploy Reports in ReportsApplication with WpfApplication. How can deploy a report in ReportsApplication with C# ? ...

When using of full text indexing in sql server give me better performance? In every where or in some situations?

I write a big application by using of NHibernate ORM. Is using of full text indexing in DB level has advantages for my application performance? does it give me better performance in searches? ...

How do I create a Foreign Key?

Hi I am working on my assignment. It has 8 tables. Each table has a primary key. What do i do to generate a foreign key to a table? My reason for asking is that when I generate a primary key, a key symbol appears on the left. What do i do to make something a foreign key? ...

How do I get the list of all stored procedures and their parameters starting with a certain prefix?

Is there a way to query the database and retrieve a list of all stored procedures and their parameters? I am using SQL Server 2000. ...

PHP Extension Not working

I am using WampServer 2.0 on Php 5.3.0 When I check the extensions, php_mssql is Checked. I also checked the php.ini file to make sure it is not commented out. I have my file dbase.php saved in C:\wamp\www\php. I have tried stopping the service, closing everything, and running it again. I know the problem is that the extension file is ...

express sql server 2008 book

hi can someone recommend a book that gives a good curriculum of how to do sql in sql server 2008? ...

Output TSQL result to textfile in script

Is there a way to directly write result returned from TSQL / stored procedure to a text file (not using CTRL + T => Result to Text). As this TSQL will be dynamic in one of my service routine. Whenever I call this service routine it generates SQL Statement => executes and here I want to direct it to text file by passing the filepath as p...

Store Procedure Select into a variable

How can I count the result of a table and pass into a Stored Procedure Variable? DECLARE @totalrecs varchar select count(id) from table1 I want the count record in the totalrecs variable. ...

Insert XML into SQL Table XML column

Am trying to insert XML into XML Column.. getting following error: . Msg 6819, Level 16, State 1, Line 5 The FOR XML clause is not allowed in a INSERT statement. My SQL query declare @tempTable Table (xmlValue xml) insert into @tempTable select EmployeeName, EmployeeSalary from Employee2 for xml path('EmployeeDetails') what am i doi...

Format XML returned from SQL for XML

Here is my Query : select EmployeeName, EmployeeSalary from Employee2 for xml path('EmployeeDetails') returns <EmployeeDetails> <EmployeeName>xxxxx</EmployeeName> <EmployeeSalary>5000.00000</EmployeeSalary> </EmployeeDetails> how can i get output as <EmployeeDetails> <EmployeeName = xxxxx /> <EmployeeSalary = 500...