I have borrowed a query and adapted it for my own purposes, but I don't like doing this when I am not entirely sure what it is doing. SQL docs are less than descriptive on this clause. Here is what I borrowed and modified, can you tell me what it is doing basically?
(SELECT Id FROM
(
SELECT
Id
,RAN...
We have a form that has multiple fields of different data type, including string, datetime and numbers.
Our customer want to be able to write N/A (Not Applicable) in any of these fields, as well as being able to leave it blank.
Does someone has an idea on how I should design my Sql Server table so it can support a value, NULL or N/A?
...
Hi all,
Just to find out my would be DB size on production environment, I just populated my tables with 1.5 million rows of nearly same data (Except Primary key). It currently shows 261 MB...
Now, Whether I can rely on this, or since the Data is almost similar on all other columns the SQL server has compressed the size. ie. Will the...
SQL Server Management Studio always inserts a GO command when I create a query using the right click "Script As" menu. Why? What does GO actually do?
I was curious about this so I looked it up. I'll provide the information I found in an answer in keeping with the SO FAQ.
...
As you can probably very soon see, I am a complete newbie at VB.NET, and I am having some trouble getting output from a stored procedure in SQL Server 2005.
This is the code I use
Dim con As New SqlConnection
Dim cmd As New SqlCommand("esp_getDates", con)
Dim par As New SqlParameter("@PlaceID", SqlDbType.Int, 3906)
con....
I was thinking of putting staging tables and stored procedures that update those tables into their own schema. Such that when importing data from SomeTable to the datawarehouse, I would run a Initial.StageSomeTable procedure which would insert the data into the Initial.SomeTable table. This way all the procs and tables dealing with the...
Hey guys,
I'm trying to modify some XML values in a database. I can get it to work on columns that contain XML that are using the XML data type. However, I can't get it to work on TEXT columns.
Also, I can SELECT XML data on TEXT columns (by using CAST() to convert it to XML), but still can't UPDATE.
Example:
UPDATE [xmltest]
SET [...
I have a method that sets up my linq data context. Before it returns the DC it calls a stored proc that sets up the CONTEXT_INFO value to identify the current user.
A trigger picks up any changes made and using this context data writes an audit record.
I noticed that my context data was in the audit table blank so I wrote a simple unit...
Is there a way we can specify values in for a case statement? The below statement doesn't execute because it thinks 53,57,82,83 etc are columns.. Is there a work around.. i googled up but found nothing that say you can't use IN case-when expression..
select
x =
case
when xvalue in ([52],[57],[82],[83])
then "xvalue"
w...
I am trying to escape the underscore character in a LIKE Statement. I have tried to use the ESCAPE keyword as follows:
COLUMNNAME NOT LIKE '%[_]xyz%' ESCAPE '\'
but it doesn't work. It is still filtering out %xyz% when I really want it to filter out %_xyz%.
If not by the ESCAPE keyword, how else can this be accomplished?
Any help is...
I've inherited an ASP.NET website written in c# using an mssql 2k8 database that is sending emails based on an insert into a message table via a trigger using database mail :| One of any failures and too many things rollback, aren't logged and no email is sent...
What a mess. I've written a few email subsystems in the past and I thoug...
How many rows can we place in a single SQL Server table?
...
Hi
How can I change the logical database name when restoring a database with SMO?
/Viktor
...
I have some records that I need to store in a database table and I want to distinguish one record from other records on the basis of name field.
But as the datatype of name field is varchar, it will effect the performance because comparing varchar data with each other is time consuming process in comparision to a numeric field.
So I wa...
I have one field named type in a database table. I want this field to contain a value from a list of pre-defined values. If I use set as the datatype of this field, then it can contain more than one values from the list.
What datatype to use, so that It can contain only one value from the list of values (pre-defined)?
...
Scenario:
There is a hierarchy of PROCESS. Like
PR-2, PR-3 are children of Pr-1,
PR-4, PR-5 are children of PR-2
Now the leaf processes (in our case PR-3, PR-4 and PR-5 can be described in terms of series of ACTIVITY
Now, ACTIVITY is just a child of PROCESS but has some extra attributes, so
Should I make two diff. tables in the d...
I have two classes Parent and Child.
class Child extends Parent {
private String extraField1;
private String extraField2;
...
}
Child class has 2 extra fields extraField1 and extraField2.
Q1. Should I make two diff. tables in the databse: one for Child and other for Parent?
or
Q1. Should I add two columns in the Parent ...
Hi folks,
I have two tables in the clients mssql database. The first is a job table - so I created an Job entity which contains the load type and load weight and all that stuff - works fine.
My problem now is that there is a second table that includes informations about the load and unload point. The second table, I call it JEP, has a...
I notice that SQL Server Explorer displays(at least) two different icons for the tables in a database, and cannot figure out what is different between the two icons.
Thanks
Anand
...
I am currently working on a project that include the use of SQLServer. I would like to know what strategy I should use when I install the software to build the database? I need to set up the tables, the stored procedures and the users.
Does my software need to make a check on start up to see if the database exist and then if it doesn't...