I saw some topics about this, but the problem is that the solutions required a "switch case"... Like this
I have a table with a lot of columns, is there a way to do a dynamic sort without the switch?
I have a stored procedure that alters user data in a certain way. I pass it user_id and it does it's thing. I want to run a query on a table and then for each user_id I find run the stored procedure once on that user_id
How would I write query for this?
SQL SERVER
i am creating windows application .In this i have to subtract two dates .i subtract it successfully ,i used TimeSpan to get subtracted value.But when i insert it in SQl Server 2005 db, it inserted with starting date i.e. 1/1/1900 and the calculated difference
which format should i use to insert Time only?
Thanks in advance
I am trying to run the following SQL statement:
"SELECT *, (IIF([Field]=TRUE,'StringValue1','StringValue2') AS [NewField] FROM [Table1] ORDER BY [NewField] ASC"
But this gives me an error "Parameter NewField has no default value". How can I solve it?
I am using Microsoft Access (MDB) database using Jet Engine from Delphi 7.
Thank you!
When I connect Access 2007 to SQL Server (whether by ADO recordset or by linked table) I no longer get check box lists (of available filter values) in the datasheet column filters.
Is this feature available only with MDB/ACCDB and/or DAO?
What is the best SQL query to remove any text within parenthesis in a mySQL database? I'd like something that works regardless of the position of the parenthesis in the text (beginning, middle, end, whatever). I don't care about keeping the text inside the parenthesis, just removing it.
Thanks!
I am involved in a project where I need to provide subset of our production data (for a date range) to one of my co-workers for trouble shooting. I would like to scrub the data and insert this in to another table. Please suggest best approach to achieve this
Hey all,
I am trying to put together a query that will display one specific record (found by the record's primary ID) at the top, and display all other records below it, sorted by date (I have "date_added" as one of the fields in the table, in addition to primary ID).
I could do this with a UNION (first select would locate the record I want, and the other select would display all other records), but I'm wondering if is there perhaps a better way?
I'm using Oracle, by the way.
I am building a c# - linq - sql server winforms/asp.net application, accessing a database. I would like my business logic layer to be easily testable, and that means not littering it with Linq database queries everywhere. What design patterns/ best practices are available for the following use cases
- inserting/updating a new object
- searching for an object
- loading a bunch of related data into a sort of "presentation" object that could be displayed by various views ?
When setting up foreign keys in SQL Server, under what circumstances should you have it cascade on delete or update, and what is the reasoning behind it?
This probably applies to other databases as well.
I'm looking most of all for concrete examples of each scenario, preferably from someone who has used them successfully.
What is index in SQL? Can you explain or reference to understand clearly?
Where should I use an index?
I searched in Stack Overflow, but it is still not clear to me.
I am using SQL server 2008 on windows 7 Machine and when i try to logon using local user i get error message login failed cannont login, i am administrator on my machine. Any Ideas?
Hi All,
According to the following section of BOL:
How to: Use Source Control with SQL Server Management Studio
If you have a source control client installed you should be able to choose it in the plug-in selection. I have both source control clients for Visual Studio 2005 and 2008 (tfs2005) installed and there's no plug-in to choose in the list for me.
I have a two-column primary key on a table. I have attempted to alter it to set the ignore_dup_key to on with this command:
ALTER INDEX PK_mypk on MyTable
SET (IGNORE_DUP_KEY = ON);
But I get this error:
Cannot use index option ignore_dup_key to alter index 'PK_mypk' as it enforces a primary or unique constraint.
How else should I set IGNORE_DUP_KEY to on?
Hi
I have 2 tables Order and orderDetails table...
I have written a inner join
SELECT Order.id
FROM Order
INNER JOIN orderDetails
ON Order.id=orderDetails.id
I have got the output as
id
100
100
100
101
101
from the above data i want the count of each record
OUTPUT AS :
id count
100 3
101 2
help me i am new to sql
Hi,
from front end application I am sending the value as 0.15 to database via a stored procedure, but it gets stored as 0 value. Why? please guide. I am using C# + ASP.NET + SQL Server 2008
Before changing the regional settings of my computer. i can save a data in my application using SQL CE. when i changed my regional settings, for internationalization purpose, i can't save anymore and no error thrown when inserting data through my application. One of the fields there is a DateTime.
What might be the problem?
Thanks
Jepe
Hi, I need to change the database name in SQL SERVER 2008 and use it in another project. However it consist hundreds of stored procedures and the name of the database should be changed in the stored procedures as well. Is there any way to do this?
I have a database with the following tables:
Employee (EmpID, FirstName, LastName, RegionID)
EmployeeSkills(EmpID, SkillID) [this is a linking table for the M:N relationship between Employees and skills]
Skills(SkillID, Description)
I need to list the name of the skill that most employees have. I tried doing a max(count(skillID)), sqlserver said that you can't do an aggregate function on an aggregate function. Any other ideas?
Thank you in advance!
What is the best way of inserting a datetime value using a dynamic sql string, whilst at the same time being able to handle the possibility of the value being null?
The current statement inserts into a table from a select statement built using a string. The datetime value is stored in a parameter and the parameter is used in the select.
Like so:
set @execsql = 'Insert into ( start_date )
SELECT ( ''' + CAST(start_date as VARCHAR) + ''' + ')'
i have a view which presently returning single record when called....i like it to return three records may be upon inner joining a different view or temp table...as those records share the same data except single column... im not sure about this plz some one throw light on this please..thank you in advance
I have a client supplied file that is loaded in to our SQL Server database. This file contains text based date values i.e. (05102010) and I need to read them from a db column and convert them to a normal date time value = '2010-05-10 00:00:00.000' as part of a clean-up process.
Any guidance would be greatly appreciated.
I'm searching a tool for generating UML-Diagrams by the import of SQL-Syntax-Files.
I need it for personal usage. Best if it's free or if there is a free trial license available.
Hi all
Here is my situation:
I use the SqlCommond to update some records in the SQL Server in a ASP.NET web site. Users can choose which records they want to update. Sometimes they may choose 40 or 60 records to update at a time.Is there any good way to do it? I do not want to do like it
foreach(string ID in List)
{
Update here
}
Best Regards,