I need to update the first digit of numbers.
For example, 3003.
I only want the first '3' to be changed to '2' and don't want the last digit '3' to be changed.
Something like the following faulty query:
update table
set defaulttopicorder = replace(defaulttopicorder, left(defaulttopicorder,1), 2)
where ....
...
I have a table with 16 columns. It will be most frequently used table in web aplication and it will contain about few hundred tousand rows. Database is created on sql server 2008.
My question is choice for primary key. What is quicker? I can use complex primary key with two bigint-s or i can use one varchar value but i will need to con...
Is there a way in SQL Server to list all the views within a database that join from a particular object?
ie: find all the views that join from the table myTable
...
Hi,
I have around 4 years experience of ASP.NET & SQL Server (only web forms). I have a little knowledge of Ruby on Rails and have developed one very small 2-3 pages application in ASP.NET MVC in my job. Now I and one of my friend ( same experience like me) are willing to gain more experience of ASP.NET MVC. For that purpose we have thou...
I'm looking for a solution to archive data that exists in my database. My database is SQL Server 2008 and have approximately 250 tables. I search web and find the below link :
http://www.dbazine.com/sql/sql-articles/charran13/
but this solution is not clear
I don't know that is there a direct way for doing this in sql server. please gi...
Hi guys,
I'm trying to create an asp .net page to backup and download an mssql db from my remote host on a shared server.
I tried using SMO to create a backup and save it the same folder as the .aspx page but it throws an access denied exception, I later found out that the sql server doesn't have permissions to write backups anywhere bu...
Hello all!
I have a DB that stores different types of tasks and more items in different tables.
In many of these tables (that their structure is different) I need a way to do it that the item has to be double-checked, meaning that the item can't be 'saved' (I mean of course it will be saved) before someone else goes in the program and c...
I'm getting crazy trying to install SQL Server Express Management Studio 2008
http://stackoverflow.com/questions/1583545/pb-for-installing-sql-server-express-management-studio-2008/1583669#1583669
I have tried 10 times, now I give up. But maybe I can try to work with SQL Server Management Studio 2005? Do you know if it will work?
...
I have some data analysis that needs to perform. On average, it would involve somewhere in between 50K-150K rows. From these rows I need to extract the summation of Sum(X) as well as Count(X) based on five different criteria. There are two ways of going about it:
Write 10 different queries, each one designed to aggregate the data from ...
I have a secondhand sale car database and four tables with relationships. Same column names have relationships.
Tables are:
Record: RecID Markname Model...
Features: FeatureID Featurename
Marks: MarkID Markname
Carfeature: CarfeatureID RecID FeatureID
Now, i want to delete a mark from Marks in c#. When i delete a mark, SQL must delete ...
I'm trying to insert some text data into a table in SQLServer 9.
The text includes a single quote.
How do I escape that?
I tried using two single quotes, but it threw me some errors.
eg. insert into my_table values('hi, my name''s tim.');
...
I have a web application developed in .net 3.5, and a SQL Server database.
Current auth method is a connection string in web.config, it seems like a good idea to move the authentication details out of plain text.
So, I have two questions:
Trusted Connection - The password policy here is strict, requiring frequent changes. Does this m...
There's more than one file system
Most version control tools operate on the local disk file system.
Database objects for most relational database systems do exist in a file system, inasmuch as there is a textual name identifying the object and the creation script can be retrieved or at least generated using this name.
But it isn't th...
Hi guys,
I have two columns of data in a SQL 2005 DB
Datetime Value
'2009-10-29 10:00:00' ' 10.1'
'2009-10-29 10:15:00' ' 10.2'
'2009-10-29 10:30:00' ' 10.3'
'2009-10-29 10:45:00' ' 10.4'
I want to
SELECT Value
FROM [table]
WHERE Datetime >= '2009-10-29 10:00:00'
AND (Datetime NOT BETWEEN '2009-10-29 10:14:00' AND '20...
I'm trying to get some values out of an Xml Datatype. The data looks like:
<Individual xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<FirstName xmlns="http://nswcc.org.au/BusinessEntities.Crm">Lirria</FirstName>
<LastName xmlns="http://nswcc.org.au/BusinessEntiti...
Please help me to read just one record from MS SQL table.
I tried to do that in the next way (IronPython 2.6 RC1):
cmd = SqlCommand("SELECT * FROM myTable", cn)
dr = cmd.ExecuteReader()
After that I have ALL the table in dr!
But need only ONE record (more precise: read table records one by one)
...
Sorry!
I was wrong!
I forget abou...
I want to add a constraint on a column that depends on a column from a different table.
For example, if in table T1 I have a string column str1, and on table T2 I have a string clumn str2, I want str1 to be null except for when srt2 - "ok".
...
Hello!
I have a table that stores articles, like the example:
Article table:
ID #CategoryID #Text #Date
So on the page I have different sections and each section has its own categoryID. For example, sports is 1, news is 2 etc.
Now I want the possibility to load the latest article from x number of categories. I have an SP that takes ...
Hi,
I'm looking for a way to join a series of SQL tables based on a list of table names. The list of table names can change as the system grows but I need to make sure the join operates on all the tables as they grow.
Each table in the list will have a common column called ActivityID which is a foreign key back to the Activity table wh...
HI,
Using: SQL Server
Database: Northwind
I'd like to drop a table primary key, without knowing the PK constraint name..
eg, using the Categories table in the Northwind Sample database, the primary key column is 'CategoryId', and the primary key name is 'PK_Categories'
I can drop the primary key while knowing the primary key name:
A...