There are multiple overloads for sqlcommand.Parameters.Add(...) function. Some of them do not take size, and some do. What sizes are set by default? Is it safe not to set parameter sizes? Does it affect performance?
...
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.
...
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,
...
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...
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...
Let's say I have an SQL table of tuples (id, lastname, firstname, occupation) where all values are strings (ok, obviously id is a key).
I want to transform it to a table with tuples (id, lastid, firstid, occupid), where I only keep pointers to other tables that contain the actual values. I apologize if the example domain of names and oc...
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 ...
I have a very simple PHP form, which shows a checkbox, and will store if it is checked or not in a database. This works for the initial inserting, but not for updating. I have tested cases where $saleid equals $pk and it does not enter the if branch to update...why?
<?php
error_reporting(E_ALL);
if (isset($_GET["cmd"]))
$cmd = $_GET[...
I've been beating my brains in over this and I'm making no progress. I'm not very good with SQL so I'm hoping the answer is something simple that I just don't know.
I have 2 tables: One called "images" that contains the data I want, organized with a primary key "imageID". The other is called "productPhotos", and it contains two fields (...
What is the difference between Join and Union? Can I get a sample?
...
Hi,
I'm retrieving Data from a Database in a record set using VB6... so while retrieving data using Select in SQL I added a column called Comments along wit it so that in the recordset, all the columns of the table+'Comments' column would be present... I don't want to(and also I cannot) update any contents in the database as i'm only 'fe...
Hi folks,
I have two tables in the system. I'm trying to make a VIEW that represents them both together, and i'm not sure how this can be done or even IF this can be done.
Pets
PetId INT PK
Name VARCHAR(100)
PetOtherNames
PetID INT PK FK
Name VARCHAR(100) PK
So, i have a table of pets. The name (in this table) is their formal co...
Hi, how do I get the fields of a column that's without a match in another column?
I tried:
SELECT table1.page_title
FROM table1, table2
WHERE table1.page_title != table2.page_title
It produces a lot of duplicate fields so I did a:
SELECT DISTINCT table1.page_title
FROM table1, table2
WHERE table1.page_title != table2.page_title
...
I'm writing an export function, where I need to export contacts to Excel, and I've run into a technical snag - or perhaps a gap in my SQL skills is closer to the truth. ;)
Here's the scenario:
I've got a bunch of contacts in a database. Each contact can have many different roles, for example a contact can be both C# Developer and DBA, o...
I am looking to create a SQL query that collects the results from multiple queries.
I would like to apply a random sort order and return a limited number of the records.
The queries will all return the same field ("RefCode" in this example), but will have different FROM and WHERE statements.
See an example below of some possible queri...
how to write 2 tables and how insert into it in a single statement
...
I have some table:
table ASK with idask
table PREFERENCES with idpref, fk_idask, fk_idstructure
table STRUCTURE with idstructure
With all the constraint between the id and the fk_id and a unique index on the table PREFERENCES (fk_idask, fk_idstructure).
The problem is when I have two row in PREFERENCES.
`IDPREF` `FK_IDASK` `FK...
hi all,
In our project we have requirement that, after receiving sms message from third party
service provider exactly after 3 minutes i need to execute a sql query to update database.
how should i do this , any suggestions are accepted.
** is it possible using stored procedures...
Exactly the scenario is , we are having mediator s...
create unique index
In DB2 UDB I can create an index using the following syntax
create unique index I_0004 on TABLENAME (a) INCLUDE (b, c, d);
where a, b, c and d are field of the table TABLENAME.
In DB2 for os390 this syntax (the INCLUDE keyword) is not allowed, so I am creating the indexes as follows
create unique index...
I use MS SQL 2008 and I want to create a trigger in a database that is created dynamic.
Creating the database is called within a stored procedure of an other database and runs perfectly, but when I want to add a trigger or a stored procedure, the executing fails.
If I try to run the dynamiy SQL with an
EXEC('USE dbase
GO
CREATE TRIGGE...