I have a problem. Actually in our application, earlier the customer was allowed to pay 3 installemnt per month but now it can be any number . So I have the earlier query
declare @tbl table([MonthName] varchar(50), [Installment] int)
insert into @tbl select 'Jan',100 union all
select 'Jan',200 union all select 'Jan',300 union all
sele...
i am dynamically creating sql query for inserting multiple records in one hit.Suppose no of record to be inserted is 1000.in that case sql query will be generated as below in code
String insertBatchSqlQuery="";
for(int currentRecordIndex=0;currentRecordIndex<totalNoOfRecords;currentRecordIndex++)
{
insertBatchSqlQuery+=getSQL...
Work on SQL Server 2000.i want to send birthday wishes to all customers whose birthday matches the current day.I have created a database Customers with a table called CustomerDetails with the following fields
ID
Name
BirthDate
Email
I have written the SQL script shown below. The SQL script loops through the CustomerDetails table and...
Hi every one!
I am using LINQ to call a function named "GetTabMenuTheme", I dragged it in the Database Model to generate the function like this:
[Function(Name="dbo.GetTabMenuTheme", IsComposable=true)]
public string GetTabMenuTheme([Parameter(DbType="NVarChar(MAX)")] string state)
{
return ((string)(this.ExecuteMethodCall(this, ((...
Using SQL Server 2005
Table1
Time
12/05/2009 08:30:49
12/05/2009 17:00:00
13/05/2009 21:00:00
...,
Above Table Both values are same column, Here I want to separate column like Date and Time
Expected Output
Date Time
12/05/2009 08:30:49
12/05/2009 17:00:00
13/05/2009 21:00:00
...
WhenI call this stored procedure:
ALTER PROCEDURE [dbo].[GetSorted]
(
@OrderByColumn nvarchar(256)
)
AS
SET NOCOUNT ON
SELECT itDocs.AddedDate, itDocs.AddedBy FROM itDocs
ORDER BY
CASE WHEN @OrderByColumn='AddedDate' THEN itDocs.AddedDate
WHEN @OrderByColumn='AddedBy' THEN itDocs.A...
Hi all
well this is the first time in this forum so I'II be clear about my question and thanks in advance
I'll create a software in C#, this app takes a CSV file (about 73,000 lines). This files comes from another system, also the CSV file can change, what's that means? the CSV file can change in one line ( the data ) or can have more ...
I'm working on a SaaS project that will have each customer having an instance of the application (customer1.application.com, customer2.application.com, etc.) and ideally each customer would have their "own" space in the DB. The current plan is to create a DB for each customer and deploy an instance of the application into the web farm. T...
I need a similar function to Oracle WM_CONCAT in SQL Server, which returns a comma separated list of whatever field you pass it as argument. For example, in Oracle,
select WM_CONCAT(first_name) from employee where state='CA'
returns "John, Jim, Bob".
How can I do this in SQL Server?
Thanks
...
Hi all!
I want to be able to store a decimal value in one column, and in the other column to store an int that represents the option (will explain):
should be base -%
should be base -absolute
should be base +%
should be base +absolute
1 & 2 is a discount
3 & 4 is an upcharge
1 & 3 reduces/raises the amount by percentage (i.e. amount *...
A while ago, I wrote a program that outputs any localhost or network database to a series of protobuf-net marked up template generated classes that I then use for all my communications architecture for my web services.
I want to put this application available online for myself so I don't have to run it locally on my machine any more, an...
Hi,
I am making changes to an existing database while developing new software. There is also quite a lot of legacy software that uses the database that needs to continue working, i.e. I would like to maintain the existing database tables, procs, etc.
Currently I have the table
CREATE TABLE dbo.t_station (
tx_station_id VA...
Scenario
I have 3 database tables. One is for Images and the other two are People & Places. Since each person can have many images and each place can have many images, I want to have a ONE TO MANY Relationship between both people and images, as well as places and images.
Question
Does the foreign key have to be called the same name as...
I understand that prior to SQL Server 2005, you could "trick" SQL Server to allow use of an order by in a view definition, by also include TOP 100 PERCENT in the select clause. But I have seen other code which I have inherited which uses SELECT TOP 100 PERCENT ... within dynamic SQL statements (used in ADO in a ASP.NET apps, etc). Is the...
I'm trying to get the top N records for each unique row of data in a table (I'm grouping on columns b,c and d, column a is the unique identifier and column e is the score of which i want the top 1 in this case).
a b c d e
2 38 NULL NULL 141
1 38 NULL NULL 10
1 38 1 NULL 10
2 38 1 NULL 1
1 38 1 ...
We have decided to put our servers in data centers on east and west coast of US, to keep high level redundancy. We like to replicate our SQL Server 2008 databases using merge replication, but going through configuration headaches.
Our SQL Server are running on web front end boxes.
Can Merge replication be set up over the internet. MSDN ...
The following are my sql server 2005 table structures:
Products (productID INT PK, ...)
ProductBids (productID INT, userID INT, Created DATETIME)
Users(UserID INT PK, TOTALBIDS INT)
Each day a user can bid as many times as they want on all the products.
There is a sql job that is run periodically, that counts the total bids a user ha...
In SQL server 2008:
Suppose I have two tables.
Table1 has 3 fields: Name, Date1 and Date2. Currently, all the Date2 entries are NULL. (Name, Date1) form a unique key.
Table2 has 2 fields: Name and Date2. (Name, Date2) form a unique key.
Every "Name" in Table1 has at least one corresponding entry in Table2.
Now, I want to update all...
We've an SQL Server DB design time scenario .. we've to store data about different Organizations in our database (i.e. like Customer, Vendor, Distributor, ...). All the diff organizations share the same type of information (almost) .. like Address details, etc... And they will be referred in other tables (i.e. linked via OrgId and we hav...
Hi, I have a complex sorting problem with my SQL statement. I have a table with the following columns.
No Time Value
-- ---- -----
1 0900 ''
2 1030 ''
3 1020 ''
4 1010 ''
5 1100 ''
1 1015 'P'
2 1045 'P'
I want to sort this table by doing the following steps.
Select rows from the ...