I want to clarify how I could import data from .csv into table with 3 columns (see CR Ranking.csv below). My query:
select * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','Text;Database=C:\Work\;HDR=Yes;',
'SELECT * FROM [CR Ranking.csv]');
Outputs results into one coulmn:
header: Category;INfo;Rank
row 1: Category 1;Info;1
row 2: Ca...
I'm working on a legacy system, and I need to call a stored procedure to retrieve the data I need. The problem is, I don't have any idea as to what the output column format is. Short of going into the stored procedure and figuring out the output column format from the SQL, is there a way for me to see what the output column types are? ...
I have the following tables:
Orders, Notes, Permits
The following columns are in each table:
Orders = ID
Notes = ID, RelatedID, Note, Timestamp
Permits = ID, OrderId
I have the following query
SELECT o.id
, op.id
, n.timestamp
FROM [tblOrders] o
INNER JOIN [tblNotes] n ON n.[RelatedID] = o.[ID]
INNER JOIN [tblPermits] op...
Hi to all,
I need help with the following. I have 2 tables. The first holds data captured by client. example.
[Data] Table
PersonId Visit Tested Done
01 Day 1 Eyes Yes
01 Day 1 Ears Yes
01 Day 2 Eyes Yes
01 Day 3 Eyes Yes
02 ...
Hey all, is there any SQL Server 2005 guru that can tell me a type of trick to get the values of what is being queried?
Ex:
UPDATE l SET Inactive = 1
FROM tbl1 e JOIN tbl2 l ON l.CID = e.CID
JOIN tbl3 p ON p.PID = e.PID
JOIN tbl4 c ON c.PID = e.PID
LEFT JOIN tbl5 g ON g.EID = e.ID
AND g.PID = e.PID
WHERE e....
Hey guys,
So I have an .aspx page loading up and populating drop downs based on a lookup table in the database. What we want is for the user to be able to configure which of these values comes defaulted by specifying that value in a drop down somewhere else in the app.
Now, it's easy to default the "first" value, or something like that...
Hi All,
I am getting this error while putting files on remote server. Please suggest me what to do. Following is the stack trace.
Void Add(System.Object, System.Object)
Item has already been added. Key in dictionary: 'HelpLink.ProdVer' Key being added: 'HelpLink.ProdVer'
System.Reflection.TargetInvocationException: Exception has been t...
hello,
this is a followup question to http://stackoverflow.com/questions/3661641/len-of-varbinary
len(0x0a0b0c0d) returns 4 because len counts bytes. does this behaviour depend on the current server collation? if i chose utf-16 for example, would it return 2? in other words, does len treat its argument as string or does it distinguish ...
I have a long running redgate script that is applying a bunch of schema type changes to a database. It is going to take 3 hours to run. This script will be run on a production database that has mirroring and transaction log shipping in place.
My specific question is how is transaction log shipping going to be affected by a huge redgat...
Dim n As Integer = DataGridView1.Rows.Add()
For Each dsrow2 As DataRow In dslocal2.Tables(0).Rows
DataGridView1.Rows.Item(n).Cells(0).Value = dsrow2.Item("Slno").trim
DataGridView1.Rows.Item(n).Cells(1).Value = dsrow2.Item("Prodcode").trim
DataGridView1.Rows.Item(n).Cells(2).Value = dsrow2.Item("Remarks").trim
Next
This cod...
I'm about to write my first procedure to check if yesterdays data exists in one database, and if it select some of the data, use a count and insert that data into another database. If the data doesn't exist, then send me an email.
I'm using SQL Server 2005 and I'd like to ask the community for tips or good starting knowledge on smart pr...
Say, I have a script nicely formatted in SSMS and it's annotated with all kinds of comments in different languages. But when I copy and paste this nice thingy into Word with syntax highlighted I will get a syntax-highlighted message with those comments garbled, as if reading the source text with one code page and pasting it using another...
CREATE LOGIN RepAcc
WITH PASSWORD = '123456';
USE master;
CREATE USER TestReport FOR LOGIN RepAcc
WITH DEFAULT_SCHEMA = master;
GO
When i click connect object explorer and choose SQL Server Authentication then
Type RepAcc as username and password 123456, i get error says can not connect, login is invalid or so. What should i do...
Hi, this subquery works in SQL Server 2005 Compact Edition 4
SELECT TableA.serialNo
FROM TableA,
(SELECT MAX(TableB.lotNo) AS lotNo,TableA.codeA,TableA.codeB
FROM TableA, TableB
WHERE (TableA.codeA =TableB.codeA)
AND (TableA.codeB = TableB.codeB)
AND ((LEN(TableA.openDat...
I have a column in Datablase Table, Suppose its Observation which contains three types of values
Positive
Negative
NULL
Now I want to count the Total no of rows , Total Positive and Total Negative and some other columns. I can not use Where clause here. And its a view
So result should be like
Total Positive Negative SomeOthe...
Assume one fine day an admin comes to the office like he always does to do his admin tasks on Sql Server Databases and to his surprise finds a database missing. He has no clue of who dropped it or was it from an external batch or SQL injection etc ... where do one start an investigation and what are the important parameters/ findings tha...
Imagine a table with like a hundred of different columns in it. Imagine, then, that I have a user-data table from where I want to copy data to the base table. So I wrote this simple insert-select statement and this error pops up. So, what's the most elegant way to figure out which column raises the error?
My initial thoughts on the solu...
I need to find rows in resultsets that have every column without null.
these resultsets got variable number of columns.
currently, the only way that I can think of is creating a view on each resultset and filter this way:
select field1, field2, field3, field4, ...
from "huge query"
where field1 is not null and
field2 is no...
From the StudentDetails Table
StudentDetails
SID Name CourseCompleted
1 Andrew CS001
1 Andrew CS002
1 Andrew CS003
2 Grey CS001
2 Grey CS005
2 Grey CS002
3 Jon CS002
3 Jon CS005
3 Jon CS008
How to generate the folowing output ( Course not completed by each stud...
I want to retrieve data from stored procedure in table format like normal sql query.
what i have to change?
my procedure is.....
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[agg]
AS
DECLARE @stud int,
@lec int,
@dept varchar(50),
@sem int
select @stud=s.sem_no_stud,
@lec=sum(convert (int,sub.sub_lec)),...