What do the following mean in an sql sytax:
(+) after a condition
eg: "WHERE table1.col1 = table2.col2 (+)
What does /* */ after select signify , i vaguely remember it being a suggestion to the optimizer, but where can i find more reference on this
eg: select /* */ ...
...
How do you write number in two decimal place for sql server?
...
I have a windows service installed using installutil and set to "Autostart". My problem is that when some servers are rebooted it attempts to start before "Microsoft SQL service" has started- I can see this by looking at the event log during a system restart. What is the best way of making my service "auto start" AFTER Sql server service...
Let's say I have the following objects:
squirrel_table
- name
- country_of_origin
- id
nut_table
- id
- squirrel_who_owns_me[fk to squirrel]
I want to retrieve a list of all squirrels in a particular country. The returned squirrel objects can be in a QuerySet, but do not need to be. A list will suffice. Each squirrel will...
T-SQL:
1(ANSI): convert(varchar(10),@DueDate, 102) < convert(varchar(10),getdate(), 102)
2(USA): convert(varchar(10),@DueDate, 101) < convert(varchar(10),getdate(), 101)
Notice that these will return different results when year is considered.
Why?
What's the difference? Why isn't the operator taking year into consideration whe...
I am joining three tables (performing a full outer join) so that I can retrieve all the records from all the tables. Problem that I am facing is with the order in which I join tables.
Table Information
(1) If I join tables in TABLE1, TABLE2, TABLE3 sequence I get two rows for record with team B and Level 1.
SELECT DISTINCT
(CAS...
The Data in my DataTable is like
ID ContactName1 Designation1 ContactName2 Designation2
1 A dummy B sam
The Table structure of my Table is
ID ContactName Designation
I am passing the values in the stored procedure as:
@ContactName1
@Designation1
@ContactName2
@Designation2
I want a single insert ...
I have a column containing items that can be sorted by the user:
DOC_ID DOC_Order DOC_Name
1 1 aaa
2 3 bbb
3 2 ccc
I'm trying to figure out a way to properly initialize DOC_Order when the entry is created. A good value would either be the corresponding DO-CID (since it is autoassigned),...
I have a SQLServer with a linked server onto another database somewhere else. I have created a view on that linked server
create view vw_foo as
select
[id],
[name]
from LINKEDSERVER.RemoteDatabase.dbo.tbl_bar
I'd like to to the following
alter table [baz]
add foo_id int not null
go
alter table [baz] with check
add constraint [fk1_...
We have a system with an Oracle backend to which we have access (though possibly not administrative access) and a front end to which we do not have the source code. The database is quite large and not easily understood - we have no documentation. I'm also not particularly knowledgable about Oracle in general.
One aspect of the front end...
I have already googled for this
I have a Table with following structure in SQL 2000
ID ContactName Designation
1 A CEO
2 B ABC
3 C DEF
4 D GHI
I need the Output as follows
ContactName1 Contactname2 ContactName3 ContactName4
A CEO B ABC C DEF D GHI
Any ...
Hi,
how do you embed your sql scripts in php? Do you just write them in a string or a heredoc or do you outsource them to a sql file? Are there any best practices when to outsource them ? Is there an elegant way to organize this?
...
Define a couple of points as follows:
declare @p1 geography, @p2 geography
set @p1 = 'POINT(1 2)'
set @p2 = 'POINT(6 8)'
Now I'd like to obtain the shortest line between these two points. What function can I use to get this line? (i.e., it should output a LINESTRING(1 2, 6 8) or LINESTRING(6 8, 1 2))
I know I could do this by formatt...
I tried searching here for a similar solution but didn't see one so I was wondering what is the best way to accomplish the following.
I have a table with 17 million + rows all have a unique ID. We have recently created a new table that will be used in conjunction with the previous table where the foreign key of the new table is the uni...
I'm trying to program an access database but I'm using SQL for all my querying. I've got the database almost complete but I have one query that has me stumped. It is a database which contains recipes. I have a table in which I have all the conversions for cooking (Tablespoon to Teaspoon, Teaspoon to Cup, etc.). The user needs to be a...
Hi all.
I am using SQL Server 2005. I am trying to join 2 tables together, but only when a column value in the main table is true. Like this:
select * from T1
join T2 on T1.value = T2.value
where T2.value2 = 'variable2'
and T2.value3 = 'variable3'
There is a coulumn value in T1 which says if I have to use the values in T2. I could to...
I'm working on performance tuning my SQL Server 2008 database and am using the output from various DMVs to identify missing indexes, indexes that aren't being used, etc.
I am mainly using these 3 scripts (from SQLServerCentral.com) that rely on DMV data that SQL Server provides:
The Ultimate Missing Index Finder
The Ultimate Duplicate...
I'm using ms sql 2008 and trying to create a database name that references another database. For example 'Dev', 'Test', 'Demo' would be database names that i could reference from my multiple config files, but each name would point to another database such as 'db20080101' or 'db20080114'.
[Edit]Some of the configs are for applications t...
I need a Regex Statement (run in c#) that will take a string containing a Sql Update statement as input, and will return a list of columns to be updated. It should be able to handle columns surrounded by brackets or not.
// Example Sql Statement
Update Employees
Set FirstName = 'Jim', [LastName] = 'Smith', CodeNum = codes.Num
From Empl...
I have a project (private, ASP.net website, password protected with https) where one of the requirements is that the user be able to enter Sql queries that will directly query the database. I need to be able to allow these queries, while preventing them from doing damage to the database itself, and from accessing or updating data that th...