Hi,
I have a tabel in an Sql Server 2005 database. I have the following column
IndPL INT DEFAULT 0 NULL
I want to change the column to be of the type NVARCHAR but I receive a constraint violation due to the fact that the column has a default value constraint attached to it.
I need to find out how to remove a default value constraint...
Dear All,
I have a problem with ROW_NUMBER() , if i used it with DISTINCT in the following Query
I have 2 scenarios:
1- run this query direct : give me for example 400 record as a result
2- uncomment a line which start with [--Uncomment1--] : give me 700 record as a result
it duplicated some records not all the records
what I want is...
This execution it is giving me an error!
Any hints of what am I missing?
declare @dbname varchar(500)
set @dbname='master'
Exec ('
Use ' + @dbname + '
go
create PROCEDURE [dbo].[krijo_database] @dbname nvarchar(2000), @Direktoria varchar(4000)
AS
BEGIN
declare @stringu nvarchar(100)
set @stringu =
''CREATE DATABASE '' +...
I have a select statement, retrieve about 1000 record
I want to modify it to return only some records defined by @startIndex and @count
e.g. : If I said @startIndex=20 and @count=20
the result will be : from the 21th record to 40th
I try to make it, but it take the same time as if I retrieve the 1000 record
what is the best way to do ...
I need to restore a backup from a production database and then automatically reapply SQL scripts (e.g. ALTER TABLE, INSERT, etc) to bring that db schema back to what was under development.
There will be lots of scripts, from a handful of different developers. They won't all be in the same directory.
My current plan is to list the scri...
how do i floor(or round) a number for a given precise?
example:
123333.333334567
after run function like floor(123333.333334567,3)
i must have 123333.333
i denoted Floor for my functionality!
...
I would like to write a T-SQL statement, that structures data to be loaded into a Ado.Net DataSet like it was possible with the ADO SHAPE command. Is there something similar in T-SQL?
My idea is to select multiple rows from a main table and all related records from a child table. That data would get loaded in to a DataSet and then I wou...
(At first glance this may look like a duplicate of http://stackoverflow.com/questions/421275 or http://stackoverflow.com/questions/414336, but my actual question is a bit different)
Alright, this one's had me stumped for a few hours. My example here is ridiculously abstracted, so I doubt it will be possible to recreate locally, but it p...
I just installed VS 2010 for the purposes of running someone else's DB project that was created using the 2010. In VS 2008 I was able to right click on a SQL file ans select "Run ON" to run the script on a given SQL Server. I don't see this option in 2010. Is it available and if so how do I get access to it?
...
I'm trying to count the frequency of numbers from 1 to 100 on different fields of a table.
Let's say I have the table "Results" with the following data:
LottoId Winner Second Third ...
I could see nothing wrong with the execution plan. Besides, as I understand it, SQL Server 2000 extended many of the performance benefits of stored procedures to all SQL statements by recognising new T-SQL statements against T-SQL statements of existing execution plans (by retaining execution plans for all SQL statements in the procedure...
I have this SQL update query:
UPDATE table1
SET table1.field1 = 1
WHERE table1.id NOT IN (SELECT table2.table1id FROM table2);
Other portions of the application can add records to table2 which use the field table1id to reference table1.
The goal here is to remove records from table1 which aren't referenced by table2.
Does SQL Serv...
Like index maintenance we have index reorganize/rebuild, update stats, shrink database log files , database backup/restore in MS SQL server, What are maintenance steps and performance steps for Mysql server/database ?
...
How many maximum recursion level possible for CTE in SQL server? If maximum recursion level is reached then what are the alternative way?
...
Hello All - I have a task to import/transform and extract zipped binary files that contain both text data as well as embedded binary data. Within the data is data that is relational in nature and needs to be processed into a defined database structure. Currently I have a C# single threaded app that essentially grabs all the files from th...
In MS SQL Server Management Studio 2005, running this code
EXEC('SELECT * FROM employees WHERE employeeID = ' + CAST(3 AS VARCHAR))
gives this error: Incorrect syntax near 'CAST'
However, if I do this, it works:
DECLARE @temp VARCHAR(4000)
SET @temp = 'SELECT * FROM employees WHERE employeeID = ' + CAST(3 AS VARCHAR)
EXEC(@temp)
I...
@FromDate datetime = null
@ToDate datetime = null
SELECT * FROM TABLE
WHERE ....
AND [PI].Date BETWEEN @FromDate AND @ToDate
When any date is null, the records are not displayed. What is the correct syntax so that I can get all records if any of the dates are null.
I have thought of this:
@FromDate datetime = '01/01/1901',
@ToDate d...
Hi,
I have a performance problem on a query.
First table is a Customer table which has millions records in it. Customer table has a column of email address and some other information about customer.
Second table is a CommunicationInfo table which contains just Email addresses.
And What I want in here is; how many times the email ad...
I'm somewhat new to SQL and need help with query syntax.
My issue involves 2 tables within a larger multi-table join under Transact-SQL (MS SQL Server 2000 Query Analyzer)
I have ACCOUNTS and LOGINS, which are joined on 2 fields: Site & Subset.
Both tables may have multiple rows for each Site/Subset combination.
ACCOUNTS: ...
Our application allows administrators to add “User Properties” in order for them to be able to tailor the system to match their own HR systems. For example, if your company has departments, you can define “Departments” in the Properties table and then add values that correspond to “Departments” such as “Jewelry”, “Electronics” etc… You...