Hi all,
Is it possible to include port numbers in hosts file? Reason that I'm asking is because I have sites that I'm trying to migrate from one hosting server to another, and the sites are pointing to an old SQL server that uses the standard TCP/IP port (1433). On the new server, the SQL Server port is different, and I don't want to ch...
I have a SQL Server 2008 database with approximately 14 millions rows. In it there are two tables
Table1
rowId int, primary key
someData1 int
someData2 int...
Table2
id int, primary key
rowId ==> int, refers to the rowId from Table1
someCalculatedData int...
Table2.rowId is not a foreign key, but I did mak...
If my stored procedure has a print statement inside it:
print 'message'
Is there a way to fetch the output in java program that connects to SQL Server 2008 through JDBC?
Also, is there a danger that print messages left for debugging would shutdown connection when called from JDBC application?
...
I want to query database two from database 1. Easy, right?
SELECT * FROM database2.dbo.TableName
Sure. But what if the actual name of database2 changes? I have to go back and change all of my procs. Imagine if the instance of database2 on the staging server is named "database2_staging"...
What I'd like is an abstraction that I could p...
Is there a way to use SqlBulkCopy without converting the data to a DataTable? I have a list of objects (List) in RAM and I really don't want to use more memory to create the DataTable. Could it be possible to implement IDataReader on a List?
Thanks!
...
do u know any example that alter the view and add new identity column to the view....
...
This could turn out to be the dumbest question ever.
I want to track groups and group members via SQL.
Let's say I have 3 groups and 6 people.
I could have a table such as:
Then if I wanted to have find which personIDs are in groupID 1, I would just do
select * from Table where GroupID=1
(Everyone knows that)
My problem is I h...
I have the following
Chars
A
C
W
B
J
M
How can I insert some sequential numbers so that after insertion of the numbers the order of characters will not change?
I mean if I use row_number(), the output Character order is changing like
select
ROW_NUMBER() over(order by chars) as id,
t.* from @t t
Output:
id chars
1 A
2 B
...
Hi,
I have a scenario where I need to search for cars by keywords using a single search field. The keywords can relate to any of the car's attributes for e.g. the make or the model or the body style. In the database there is a table named 'Car' with foreign keys referencing tables that represent models or makes or body style.
What woul...
I am writing an class using C++ (ATL).. I need to connect to a database. I am familiar with ADO but I see that all the functions are using IDispatch (late-binding/Automation). I am considering using OLEDB instead. What are the pros and cons of each? OLEDB seems like a lot of maintenance if the sql changes (tables, stored procs, etc). I d...
In SQL Server 2005
I have record like this
column_name
1.23424
4.32524
5.24123
7.84927
10.76192
2.77263
how to to SUM() just only 2 decimal?
column_name
1.23
4.33
5.24
7.85
10.76
2.77
thanks
...
I am investigating an issue relating to a large log expansion during an ETL process, even though the database is set in bulk logged mode (and it is not running in psuedo simple but truely bulk logged)
Using the ::fn_dblog(null,null) function to examine the transaction log operations and the context of the operation, the log expansion is...
I am working on social networking site. now our team decide to store user profile in denormalized manner. so our table structure is like this
here attribute it means one fields for user profile e.g. Firstname,LastName,BirthDate etc...
and groups means name of a group of fields e.g. Personal Details, Academic Info, Achievements etc..
*...
Given:
WHERE (@Id Is NULL OR @Id = Table.Id)
If @Id is null: the expression evaluates to true. Does the second part @Id = Table.Id still get considered? or is it sufficient that the expression evaluates to true given that the first part is (which is the case in c#).
This is relevant because of some much more complex OR statements whe...
I have a column of database names like so:
testdb_20091118_124925
testdb_20091119_144925
testdb_20091119_145925
ect...
Is there a more elegant way of returning only similar records then using this like expression:
select * from sys.databases where name
LIKE 'testdb[_][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][_][0-...
Let's assume that I'm doing some sort of nontrivial change to my database, which requires "custom" work to upgrade from version A to B. For example, converting user ID columns from UUID data type to the Windows domain username.
How can I make this automatically deployable? That is, I want to allow developers to right-click the project, ...
Using SQL Server, what is a simple but effective means of denying access to data older than a certain date, for some users?
We can do this at the application level (a web application) but this leaves us vulnerable to scenarios such as IIS being hacked or bugs in our application. Ideally only certain SQL users should have access to certa...
I have query like this
DECLARE @A INT
SET @A = 22
SELECT Moo, 1st - 2nd + 100 AS WWW
FROM (
SELECT 1 + Num AS Moo,
((@A-100)*3)+num AS 1st,
((@A-100)*4)+num AS 2nd
FROM tblC
WHERE ColA = 'Atic' AND Num < 7
) AS TTT
How to use CTE to rewrite same query?
...
Hi,
We have an application that is written in C# that is connected to a ms sql server.
We use to make a stored procedure for every database call, but then we've noticed that using stored procedures gives us a very big disadvantage, we don't know what stored procedures we need to update if we change our database.
Now I was wondering if ...
I using this loop to print number
DECLARE @A Int
SET @A = 33
WHILE @A < 55
BEGIN
SELECT @A as sequence
SET @A = @A + 1
END
GO
But problem that with every loop message is printed like example:
sequence
-----------
53
(1 row(s) affected)
How to print in order like this:
34
35
36
37
Can help me with CTE example for this?
...