sql

New line in Sql Query

How you get new line or line feed in Sql Query ? ...

SQL comment header examples

Would just like too see what peoples Stored Procedure/Function etc comment headers look like (so post your examples)...I've only really seen what the SQL Server Management Studio creates but am interested in what other peoples look like...the formatting, characters used, procedure information/details etc I guess are what really makes the...

SQL Server 2005 - Syncing development/production databases

I've got a rather large SQL Server 2005 database that is under constant development. Every so often, I either get a new developer or need to deploy wide-scale schema changes to the production server. My main concern is deploying schema + data updates to developer machines from the "master" development copy. Is there some built-in funct...

Is it really helpful to store content in flat-file than a database for better google/yahoo/bing searches?

I just came across few articles, while selecting a wiki for my personal site. I am confused, as i am setting a personal wiki for my personal projects, i think a flat file system is good, even to maintain revisions of the design documents, design decisions, and comments/feedbacks from peers. But the internet gives a mixed bag of response...

Select most recent dates

Hello, I am trying to write a query that will return only the most recent results. The table I am pulling information from has no uniqiue columns, and contains information on rate changes so for any particular client there can be several rate changes - I only want the most recent rate change for each client. The structure is: mrmatte...

SQL - Ordering by multiple criteria

I have a table of categories. Each category can either be a root level category (parent is NULL), or have a parent which is a root level category. There can't be more than one level of nesting. I have the following table structure: Is there any way I could use a query which produced the following output: Free Stuff Hardware Movies ...

i want to get records using like keyword

Hi friends!! I have the following query which is working fine, but I also want to get records using the like keyword. My query is as follows, USE [POBox] GO /****** Object: StoredProcedure [dbo].[test] Script Date: 07/06/2009 12:55:39 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[test] --'DateTime'...

displaying images from different sources...

I am trying to generate an image report for a particular items. Every item has a unique item number, which is stored in the variable $pk. In this, calling up images/$pk.jpg and/or screenshots/$pk.jpg will show the relevant image or screenshot for the current item page. This works fine in the actual page, however not in my popup report. ...

Django : I have a save() which is failing. How can I see the SQL that's generated?

I have a failing model.save() in my Django app. How can I see the SQL that was generated by it? ...

How do I define table relations in a circular reference?

In my current project I have data about colors. Each color is either a real color (with RGB values) or is a "container color" that exist out of multiple layers of colors. This potentially creates circular references which will have to be caught at application level (but that's another question) So I have Colors ------ + (PK) Id Color...

Django : Error thrown by database : relation "_mytable" does not exist (for a content_type) . Lost app-name

In Django, I have a model, let's call it "MyTable" which uses a content_type Foreign Key to refer to, amongst other things, Profile. In most cases (as in my unit-tests) I have no trouble with it, but in a certain circumstance in the view I try to save a Profile object (with Profile's .save() ) and the database throws this exception : r...

Best Practice: Direct SQL Access vs. Web Service

With respect to an application that has both a web and desktop client version: What is the best practice for the desktop client which needs access to a SQL Server? What are the benefits of connecting to the database from the application vs using a web service? Which one provides better security? What type of scope would call for on...

Can two different sites running on same host, share same database for storage and retrieval?

I am building a personal site, for blog i wish to use wordpress and for a wiki i will use wikia. Is it possible that i use the same database for storing articles from both the frontends (wordpress and wiki). If yes can i some how populate articles from my wiki to the blog, under a specific category. EDIT-- By two different sites I mea...

Script for rebuilding and reindexing the fragmented index?

Can anyone provide the script for rebuilding and reindexing the fragmented index when 'avg_fragmentation_in_percent' exceeds certain limits without using a cursor? ...

Is there a standard way to duplicate a row in a database table?

I want to duplicate a row, not the keys of course, without explicity using the field names. Is there a SQL way or do I have to enumerate the field names through code? I don't want to explicity use field names because I want to minimize code and db dependencies. I am going to use it in the Ms Access 2003. I mention it in case that no s...

Help me put Oracle terminology into SQL Server terminology

My company is now supporting Oracle for the first time, and most of my colleagues are SQL Server developers who haven't really worked with Oracle. I'm a little bit familiar with Oracle, but far from a genius on the subject. Unfortunately, that is enough to mean that I know more about Oracle than most of my co-workers, so I find myself ...

why am i getting Index was outside the bounds of the array

hi im getting Index was outside the bounds of the array when i go to insert a linq statement > slot_tbl_Schedule slot = new slot_tbl_Schedule { OrderID = int.Parse(lblOut.Text), FromTime = DateTimeValue, ToTime = DateTimeValue.AddMinutes(30), BookedDate = DateTi...

full text search, filter results for best match

I have 3 tables that link up. Restaurants, Cuisines and Cuisine Type. A Restaurant can sell many cuisines of food (that's bad wording but you get idea?) So I have Full text setup on Restaurant:Name, CityTown, Postcode and on CuisineType:Name I have one searchbox on my home page and as the user types results are filtered to best match....

Creating batched sql statements

I have a small job that takes a text file of email/zip codes and inserts them into a sql server 2005 table. It reads each line of the source file, checks to make sure that it parses into a valid email address/zip code, creates a sql insert command, adds it to a string builder and eventually executes it. I want to do a single execute inst...

Need help in cascade='delete'

Hi guys, I don't know whether this question has been asked before or not. But i was trying to use cascading delete, but couldn't find enough documentation to get my answers that is why Im asking here. I have one parent class and two child classes dependent on that. When i delete parent it should delete the other two child classes as wel...