edit - Based on the responses below, I'm going to revisit my design. I think I can avoid this mess by being a little bit more clever with how I set out my business objects and rules. Thanks everyone for your help!
--
I have the following model:
S belongs to T
T has many S
A,B,C,D,E (etc) have 1 T each, so the T should belong to each...
Ok SO, I have a user table and want to define groups of users together. The best solution I have for this is to create three database tables as follows:
UserTable
user_id
user_name
UserGroupLink
group_id
member_id
GroupInfo
group_id
group_name
This method keeps the member and group information separate. This is just my way of...
I have a table MRU, that has 3 columns.
(VALUE varchar(255); TYPE varchar(20); DT_ADD datetime)
This is a table simply storing an entry and recording the date time it was recorded. What I wanted to do is: delete the oldest entry whenever I add a new entry that exceeds a certain number.
here is my query:
delete from MRU
where type ...
I'm using SQL Server 2008.
Is it possible to create a script to loop over all tables in a database generating a set of index drop scripts and create scripts separately?
What I have to do is drop all indexes on a set of databases to run a heavy data load process but then I want to re-enable all the indexes. I don't want to have to go th...
I have 2 MySql tables. users with id's and username's ; streams with userId's and streamId's How to get them as / join them into one table containing only
username | streamId as SQL response? With one SQL query.
...
I have FK and PK all over my db and table data needs to be specified in a certain order or else I get FK/PK insertion errors. I'm tired of executing the wizard again and again to transfer data one table at a time.
In the SQL Server export data wizard there is an option to "Write a query to specify the data to transfer". I'd like to writ...
I am trying some SQL code but I get an error when I try this code.
Main.database.ExecuteCommand("UPDATE Contacts SET first_name='" + c.first_name + _
"', middle='" + c.middle + _
"', last_name='" + c.last_name + _
"', age='" + c.age + _
...
I'm wondering if anyone is currently utilizing Microsoft's Master Data Services? How you are utilizing it? Whether you find it useful? When you believe it would be useful? Thanks!
...
How to create a unique constraint on a varchar(max) field in visual studio, visually.
the problem is when i try it:
manage indexes and keys > add > columns
I can only chose the bigint columns, but not any of the varchar(max) ones.
Do I maybe have to use check constraints?
If yes, what to put in the expression?
Thnx for the info
...
I have a legacy FoxPro application which stores documents in an SQL table in a field with the image datatype. FoxPro accesses the image datatype as a "General" field which can be used to store various files. I have a FoxPro control which interfaces with the General field for modifying/viewing the document that was stored. I need to migra...
I created a query in Microsoft Access like the one below:
SELECT Deliverables.ID, Deliverables.Title, Deliverables.Summary,
Deliverables.Header_Code, Deliverables.Header_Code.Value, Deliverables.Sort_order,
Deliverables.Pillar, Deliverables.Pillar.Value, Deliverables.Misc_ID
FROM Deliverables
WHERE (((Deliverables.Pillar.Value)="Link ...
Hello guys
does anyone know how to convert this SQL statement to a LINQ to a List?
SELECT TOP(5) COUNT(Tickets.CategoryId), Categories.CategoryName
FROM Tickets
INNER JOIN Categories ON Tickets.CategoryId = Categories.CategoryId
GROUP BY Categories.CategoryName
ORDER BY 1 DESC
The result would be something like this?
public static ...
I have a table with 10 columns that need to be searchable (the table itself has about 20 columns). So the user will enter query criteria for at least one of the columns but possibly all ten. All non-empty criteria is then put into an AND condition
Suppose the user provided non-empty criteria for column1 and column4 and column8 the query...
hey all. I have a table in my DB that has about a thousand records in it. I would like to reset the identity column so that all of the ID's are sequential again. I was looking at this but I'm ASSuming that it only works on an empty table
Current Table
ID | Name
1 Joe
2 Phil
5 Jan
88 Rob
...
Here is my scenario, I'm creating a dynamic query using a select statement which uses functions to generate the query. I am storing it into a variable and running it using exec. i.e.
declare @dsql nvarchar(max)
set @dsql = ''
select @dsql = @dsql + dbo.getDynmicQuery(column1, column2)
from Table1
exec(@dsql)
Now it produces the many...
Suppose I have 3 tables.
Sales Rep
Rep Code
First Name
Last Name
Phone
Email
Sales Team
Orders
Order Number
Rep Code
Customer Number
Order Date
Order Status
Customer
Customer Number
Name
Address
Phone Number
I want to get a detailed report of Sales for 2010. I would be doing a join. I am interested in knowing which of the fo...
I am testing out my scripts to see if they will prevent xss and sql injections. Can someone provide me with some basic but good scripts that would "hack" into my programs. I want to test my scripts before it goes online.
EDIT: Thank you all for those links, they contain loads and loads of information. But for a beginner to security, is...
I have a table having a single auto Auto Incremented column. How Can i insert the value. Using
Insert into table or some other way
Thanks
Waiting for your replay..
...
I have a subreport inside a main report on a new page due to the layout. When the subreport generates no data(sql table is empty), there is a blank page generated in the mainpage. How can i omit this empty page? please help me here..
...
I have an application that stores data through an ODBC data source of the user's choosing. So far it has worked well on a range of database systems (e.g. JET, Oracle, SQL Server), as the SQL syntax is fairly simple.
Now I am running into a problem where I need to store more than 255 characters in my strings. Previously I created the tab...