Use this tag for questions specific to the 2008 version of Microsoft's SQL Server.
0
votes
0answers
4 views
Need help splitting a field with XML-like data in SQL Server 2008
I have a varchar field in a table, which contains a string of XML-like data. I say "XML-like" because the string usually gets truncated before I get all of it. I need to pull the and sections out ...
0
votes
1answer
41 views
Insert when NOT matched - T/SQL
I have 3 tables with same 5 columns (+ 1 flag column in T2 which we will use later...let's focus on 5 columns for this example).
T1, T2, and T3.
1st column in all three tables are Key Columns.
...
0
votes
2answers
54 views
SQL Joining corresponding values in a table
So I have a table (call it tbl1) that looks like (but with much more rows) :
CUSIP_ID1 CUSIP_ID2 cor dt_pnts
921910709 06738G407 0.99613 252
739371102 ...
0
votes
2answers
31 views
MERGE Issue In Bulk Insert Sproc
I am having an issue with my "Merging":
The MERGE statement attempted to UPDATE or DELETE the same row more than once.
Can someone help me fix this, as I do not understand how to correct the issue:
...
0
votes
1answer
36 views
Any way to generate hierarchical values in sql server 2008
We need the values in hierarchical data format as below using SQL Server,
1
1.1
1.1.1
1.1.1.1
1.1.1.2
1.1.1.3
1.1.2
1.1.2.1
1.1.2.2
1.1.2.3
1.1.3
1.1.3.1
1.1.3.2
1.1.3.3
1.1.4
1.1.4.1
1.1.4.2
1.1.4.3
...
1
vote
0answers
15 views
Visual Studio 2012 Server Explorer DefaultView view error?
Can anyone tell me what the $#%& this is? I'm assuming its a local only issue since I can't find anything on the net pertaining to it in particular.
I've even gone through and deleted all the ...
0
votes
2answers
10 views
How to use index column in many-to-many association in criteria in Hibernate?
I'm using Hibernate 3 with Java.
My POJOs classes are as follows:
Teacher.java
private long id;
private String teacherName;
private List<Student> students;
// getter-setter of all
...
0
votes
1answer
21 views
Is the “owner” of a table/view/proc always a SCHEMA?
I did a lot of research on ownership chaining, but I am still not sure if I understood it.
So: Is it correct to say that the "owner" of a table/view/proc is always a SCHEMA ?
If A.PROC accesses ...
1
vote
0answers
15 views
Unwanted validation of synonym to remote table at compile time - SQL2K8 R2
I'm working in an environment where data exists on numerous client databases and one by one is pulled into a central data repository via sql.
To automate a testing process, I've written a really ...
0
votes
2answers
24 views
Change length of column of table which have dependencies
I've got a table named Contacts with column Title varchar(50) . Now in the middle of development I want to change the length to varchar(100) of field Title .At the moment table Contacts has over 25 ...
0
votes
0answers
9 views
Filling MS chart with data from SQL Server
I have an application in which i have to collect data from a SQL Database and show it in MS chart trend.(The data consists of one date time column and few float columns, The float values should be ...
2
votes
2answers
42 views
Temporary table in SQL SERVER - error occur if the query takes long time to complete
Have a look a the following query.
select *
into TempTable
from MainTable
select * from TempTable
WAITFOR DELAY '00:00:10'
drop table TempTable
After executing this query, I open other window ...
0
votes
0answers
23 views
sp_OAMethod is not working
I wanna send sms from Sql Server 2008 and my code is like that
DECLARE @oXMLDom int
DECLARE @hr int
DECLARE @src varchar(255), @desc varchar(255)
DECLARE @bLoaded bit
DECLARE @xml as ...
0
votes
1answer
29 views
User can delete rows from a table by calling a procedure
I'm getting somewhat confused with SQL Server security
we have a login and a user: test
we have a table: dbo.tblSessionFilter
User test has no select and no delete permission on this table (I ...
0
votes
1answer
18 views
How to get the caller's user id in an impersonated procedure?
If you write a procedure with "execute as xxx", is it possible to retrieve the original user, who called the procedure, somehow within the procedure ?
1
vote
1answer
22 views
Microsoft dynamics CRM 2011 : error 404 after moving my database
I just moved my database from my development server to my deployement server. I used this tutorial from microsoft to do so : ...
1
vote
1answer
39 views
what does DBCC DBREINDEX('?', ' ', 80) do?
What exactly does the following statement do? Does it reindex all tables named '?' with a fill factor of 80% ?
EXEC sp_MSforeachtable @command1="print '?' DBCC DBREINDEX ('?', ' ', 80)"
It did ...
1
vote
1answer
40 views
Impersonation in SQL Server Views?
Is it possible to create views with impersonation, similar to "execute as" in stored procedures?
I would like to create some views in a separate schema. Some users should get SELECT and UPDATE access ...
-1
votes
2answers
34 views
Combining output of two or more select statement
How to combine output of two or more SELECT statements, I have multiple tables which are having some data that I need to fetch them so I write multiple SELECT query. Now I want to combine result of ...
1
vote
2answers
25 views
Is it possible to set current date in stored procedure parameter?
I want to set GetDate() as default parameter value. But it shows error. Below is my block of code:
Create Proc XYS
(
@myDate datetime = GetDate() //error
)
AS
SET @myDate = GetDate() // i can do ...
0
votes
0answers
19 views
Restict SQL Server access for certain application
I want to deny the access the DB as SA from SSMS but allow them to make changes through the other application when logged in as SA. I used the following code but system throwing error. Please suggest ...
0
votes
0answers
19 views
Regular expression for comparing strings in an SQL Query
I am working on a report which shows rules which have been breached. The report also shows description of these rules.
The rules are evaluated in a separate system, this external system updates two ...
0
votes
2answers
22 views
How to get a particular date format ('dd-MMM-yyyy') in SELECT query SQL Server 2008 R2
I am using CONVERT(data_type(length),expression,style) function to change the format of a date in a SELECT query.
Declare @dt nvarchar(20)
Select @dt = Convert(nvarchar(20), SalesDate, 113) ...
0
votes
1answer
18 views
Insert into database select * from database2 where (somecondition) order by xyz
INSERT INTO [APL4_WATERPLANT].[dbo].[PRINT_PWD]
([DATEANDTIME],[CLT_2101] ,[CT_2101] ,[FT_2101] ,[TT_2101] ,[TT_2102] ,[VT_2101] ,[TOC_2101] ,[GEN_COND] )
SELECT *
FROM
...
0
votes
1answer
20 views
Best way to reduce physical space of DB
i have a problem. My SQL Server is soon running out of space.
I've already tried to delete some unused tables in different DBs but that doesnt change the free disk space somehow. I read about some ...
0
votes
1answer
11 views
Code and Data Security considerations during website deployment?
I will soon be hosting my MVC site to an external provider (I am yet to finalize the hosting services company).
My website is developed using ASP.NET MVC 4 and it is using SQL Server 2008 as its ...
-1
votes
2answers
32 views
Convert data in Gridview into excel or PDF [on hold]
I have an application in C# winfows form. I just want to know how to convert data in Gridview into excel or PDF.
1
vote
1answer
41 views
EF insert not follow db auto increment(DB First)
.EDMX
<Property Name="uid" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
EF had set the StoreGeneratedPattern = "Identity", but why I still cannot save into db? Debug show ...
0
votes
3answers
50 views
SQL Server : unsure how to retrieve selected records
In this example, can I retrieve only rows BB, DD, and FF using T-SQL syntax and a single select statement?
C1 | C2 | C3 | C4
-----------------
AA | KK | 11 | 99
BB | KK | 11 | 99
CC | KK | 22 | 99
...
0
votes
1answer
18 views
Retaining existing table values using a Stored Procedure with Optional Parameter Values
I have this scenario ---- where a stored procedure may be given parameter values optionally.
If the values are empty/default I would like to retain the existing values.
Is the following way of ...