all groups > sql server programming > february 2007 > threads for wednesday february 21
Filter by Day: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
advice - store big file in a DB
Posted by ina at 2/21/2007 11:49:21 PM
Hello Guys,
I would like to store big file in database? (between 3 to100 pages
with pictures)
What do you advice to do? storing the information in ntext field? or a
link to this file?
I would like to generate report querying this table and have all the
information in a whole and unique ... more >>
Schedule export from sql database to access
Posted by Ricky at 2/21/2007 11:46:02 PM
Hi
Can someone explain/help how can I create a schedule at SQL Server 2000 that
exports at X time of the day a SQL database into a access database without
exporting the views that the SQL database has.
Thanks
[]
Ricky
... more >>
how to get value of SCOPE_Identity from stored procedure?
Posted by michel at 2/21/2007 11:43:46 PM
Hi,
I made a stored procedure for inserting a record. After that, i need to get
the value of SCOPE_IDENTITY() in my VB.net code. I tried this, but the
returned Executescalar value (x) is nothing.
Thanks for help
Michel
create PROCEDURE dbo.insert_orders
(
@var int,
...
)
AS
... more >>
Scalar Function!
Posted by Adam Knight at 2/21/2007 10:49:42 PM
Hi all,
I want to return a scalar value from a function, but am not sure of how to
create such a function.
My attempt so far is:
CREATE FUNCTION [dbo].[GetValue] (INT @ID)
RETURNS INT
AS
BEGIN
SELECT myColValue FROM myTable WHERE myID = @ID
END
Obviously this doesn't work ... more >>
How to Document my Database?
Posted by Leila at 2/21/2007 10:44:26 PM
Hi,
I want to document a huge database, but I don't know where to start, what to
document.
Are there any samples or tools for this job? What should be documented?
Thanks in advance,
Leila
... more >>
is it possible to translate this to a stored procedure?
Posted by michel at 2/21/2007 7:40:15 PM
Hi,
this code inserts data into two tables: table1 (base) and table2 (details).
The last ID of primary key in table1 must be inserted in table2.
Table1 receives one record, while table2 receives more records, each with
the same last ID of table1.
This works.
My problem is to putting thi... more >>
How to update these records better?
Posted by Cylix at 2/21/2007 5:56:44 PM
I have a long record with data as follow:
StringDATA1: 0001, 0002, 0003, 0004
StringDATA2: aaaa, bbbb, cccc, dddd
StringDATA3, WWW, XXX, YYY, ZZZ
I need to perform the following three SQL Stataements to do what I
need.
UPDATE myTable SET COL2 = 'aaaa', COL3='WWW' WHERE COL1='0001'
UPDATE my... more >>
Ad Hoc access to OLE DB provider 'MSDASQL' has been denied error
Posted by Tim Zych at 2/21/2007 5:24:33 PM
I can run a query that accesses a server and database no problem, as a
developer. The user can run the same query no problem on another database
and server.
When a user tries to run a query (via a VB.Net project), they get an error:
"Ad Hoc access to OLE DB provider 'MSDASQL' has been deni... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Fast search using SELECT
Posted by PV at 2/21/2007 5:06:00 PM
I have a database that has 2million paragraphs in it.
I use the SELECT FROM table WHERE dbparagraph = '" & varParagraph &"'
If it comes back with no records I know that the database does not contain
the paragraph that I am trying to store so I store it using the INSERT
command.
All works ... more >>
Using ROLLUP, but ordering by summary row
Posted by JJ at 2/21/2007 4:58:59 PM
I have a table like the following:
CREATE TABLE UserStats (
UserName varchar(30),
FuncName varchar(30),
AccessTime datetime
)
If I do the following:
SELECT UserName, FuncName, COUNT(*) as UsageCount
FROM UserStats
GROUP BY... more >>
can't CREATE / deploy UNSAFE assembly
Posted by barick at 2/21/2007 4:27:16 PM
The documentation says:
To create an EXTERNAL_ACCESS or UNSAFE assembly in SQL Server, one of
the following two conditions must be met:
1. The assembly is strong name signed or Authenticode signed with a
certificate. This strong name (or certificate) is created inside SQL Server
... more >>
Expected end of statement error
Posted by Rick Johnston at 2/21/2007 4:07:51 PM
In the statement below, I am trying to define EndDate as the date 2 months
prior to the current date; but obviously I have a syntax error. Enclosing
the "m" in double quotes doesn't help.
Thanks in advance for any help on this.
Rick
Microsoft VBScript compilation error '800a0401'
Exp... more >>
EXEC with dynamic SQL and variable
Posted by SewLittleTime NO[at]SPAM gmail.com at 2/21/2007 4:01:05 PM
Why isn't this working?
-- define query string for dynamic SQL
SET @QSIdentOn = ('SET IDENTITY_INSERT ' + @QSDestinationTable + '
ON')
-- print it out for confirmation
PRINT '@QSIdentOn = ' + convert(varchar(250),@QSIdentOn)
-- the print results
@QSIdentOn = SET IDENTITY_INSERT databasename... more >>
Concurrency notification question
Posted by Earl at 2/21/2007 3:51:48 PM
I'm posting this question in both the SqlServer and ADO.Net newsgroups in
the event there might be a programmatic answer on either the frontend or the
backend.
Imagine a small network running the same app attached to SqlExpress. A
listbox is filled via a datareader with contact names using ... more >>
Adding new row to SQL Server 2005 database
Posted by TAC at 2/21/2007 3:25:27 PM
I am new to SQL Server 2005. I have a large database table, and I want to
add new rows (records) to the table from within a C# program. The simplest
method would seem to be using a T-SQL INSERT command, but T-SQL does not
accept variables as input (only immediate values).
I can also u... more >>
Merge Replication: Snapshot folder remains after parameterized filter subscription is deleted?
Posted by Crash at 2/21/2007 3:21:22 PM
Publisher:
- Windows 2000 SP4
- SQL Server 2005 Standard Edition SP2
Subscriber:
- Tablet XP SP2
- SQL Express SP2
- VS 2005, .NET 2.0, SMO & RMO coded in C#
Hi,
We have a publication that uses parameterized filters. I followed the
steps listed in the RMO documentation and coded a ... more >>
database alias name
Posted by struchnjak at 2/21/2007 1:13:19 PM
Hi All,
database alias name would be the great feature to have...
In one application we have folowing solution:
we backup and restore a database with different name, so in case tomorrow we
get wrong data in the current db, we can switch to the previous days database.
Web application checks i... more >>
Transaction log growth in simple mode
Posted by Sammy at 2/21/2007 12:46:03 PM
Hi is it possible that a transaction log with a DB in simple recovery mode
on Sql Server 2005 could grow to 50GB. The Db itself is 30Gb. I thought a Db
in simple recovery mode would truncate its log every minute or so. Would a
running transaction prevent the log getting truncated? I have a ... more >>
Why can't I SELECT from sys.dm_exec_connections?
Posted by Dave at 2/21/2007 12:04:05 PM
I have a stored proc that needs to authenticate the user based on their IP of
their connection.
I can get the IP from the system table "sys.dm_exec_connections" but I get
an EXECUTE permissions error when logged in as the user who will call the
proc.
SELECT ALL is granted to PUBLIC for... more >>
Change DB logical Name
Posted by JFB at 2/21/2007 11:32:18 AM
Hi All,
I have a problem with one of my databases, looks like original the create
the files using one name and after someone rename this database.
Now in my phisical file name is the newDataName_Data.MDF and LDF but when I
see the logical files still the OldName_Data.MDF and LDF.
How can I fi... more >>
Universal Paging Procedure - is this bad?
Posted by Jeremy at 2/21/2007 11:13:17 AM
I'm trying to create a procedure that will give back pages of results,
without having the logic coded into every one of our procedures. What I have
created is a proc that crops out one page of results from a temp table:
~~~~~~~~~~~~~~~~~~~~~~~~~
CREATE PROCEDURE temp_PageAny(
@TempTableNam... more >>
Confusion in Results tab of Query Window
Posted by Flomo Togba Kwele at 2/21/2007 11:04:21 AM
I made some changes to SQL Server Management Studio, and now the output
of a query going to the Results pane show the following:
Table 'sysschobjs'. Scan count 1, logical reads 2, physical reads 0,
read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-
ahead reads 0.
rat... more >>
C2 SQL auditing question
Posted by SQL apprentice at 2/21/2007 10:39:14 AM
Hi,
I setup my SQL 2000 Server to use C2 auditing. It is working.
My only problem is that my trace file does not get populated while I am
inserting/updating/select data or anything.
However, when I stop SQL server then my trace file gets populated.
I cannot stop a production SQL server on an... more >>
trigger after delete problem --- msg 3727 and 3728
Posted by ina at 2/21/2007 8:50:46 AM
Hello Guys,
I have a problem with this trigger after delete:
What I would like to do:
Everytime a row from A is deleted automatically the a colum from D
which has the same (Name) is deleted as well:
CREATE TABLE A (
[A_ID] [int] IDENTITY (1, 1) NOT NULL ,
[A_NAME]AS ('A' + right([A_I... more >>
trigger after delete problem --- msg 3727 and 3728
Posted by ina at 2/21/2007 8:49:38 AM
Hello Guys,
I have a problem with this trigger after delete:
What I would like to do:
Everytime a row from A is deleted automatically the a colum from D
which has the same (Name) is deleted as well:
CREATE TABLE A (
[A_ID] [int] IDENTITY (1, 1) NOT NULL ,
[A_NAME]AS ('A' + right([A_I... more >>
Creating SQL views
Posted by Jay Bukstein at 2/21/2007 8:47:37 AM
I need to create a SQL view that does more than a select... statement. I
need to first of all use tempdb for temp tables, and 2 run through a cursor
to build the my temp tables first. So, my format looks like this,
Create view abc
as
<Cursor to build temp table>
<Build a Temp look u... more >>
Sp_helptext
Posted by IT at 2/21/2007 8:43:00 AM
Hello
I connect to the SQL Server with both windows authentication , and I am
sysadmin rights on SQL Server as well tried the below connecting as sa .
The issue is:
When I run the following
select * from sysobjects where name like '%abc%' and type ='p'
I get 1 row , with stored ... more >>
wierd float division
Posted by nabeel.moeen NO[at]SPAM gmail.com at 2/21/2007 8:40:29 AM
Hi,
I have a table with two float columns x & y.
there is one row in the table
x y
181.0 1000.0
Following is a query and its result set:
Query:
select x, y, x/y , 181.0/1000.0 from #temp
Result:
x y x/y
col4
181.0 1000.... more >>
Variable in the FROM clause
Posted by JayKon at 2/21/2007 8:37:48 AM
Why doesn't this work? How can I do it?
USE pubs
DECLARE @Table VARCHAR(128)
DECLARE @TheCount INTEGER
DECLARE cTables CURSOR FOR
SELECT name FROM pubs..sysobjects WHERE type in ('U')
SET @TheCount = 0
OPEN cTables
FETCH NEXT FROM cTables INTO @Table
WHILE (@@FETCH_STATUS=0)
BEG... more >>
Can't kill a processus
Posted by Catalin NASTAC at 2/21/2007 8:37:03 AM
Hello, I have a VB 6 application that connect to SQL and execute something.
The VB crash and the application is closed. But on SQL I still have a process
that is blocked by itself. When I try to kill it it says "transaction
rollback in progress. Estimated rollback completion: 0%. Estimated ti... more >>
IDENT_CURRENT returns 0 while Seed is 1
Posted by Dmitry at 2/21/2007 8:17:37 AM
Hi,
I have noticed on some of our tables, residing on SQL Server 2000, and
having primary key column set as IDENTITY(1, 1), value for IDENT_CURRENT beng
zero when table is empty.
the expected value is 1.
there is no problem fixing it by reseeding it with DBCC CHECKIDENT over all
table... more >>
create db failed
Posted by paul at 2/21/2007 8:06:55 AM
I'm seeing the following error when creating a db from c# code:
CREATE DATABASE failed. Primary file must be at least 3 MB to accommodate a
copy of the model database.
sql:
CREATE DATABASE MyDb ON PRIMARY ( NAME = x_dat', FILENAME = 'x.mdf', SIZE =
2048 KB, FILEGROWTH = 10% ) LOG ON ( N... more >>
tricky "group by" question
Posted by bonit99 NO[at]SPAM gmail.com at 2/21/2007 7:21:28 AM
Hello,
I have the following problem. I have the following table with values
id value date anothervalue
1 10 17.01.2007 2
2 10 10.01.2007 2
3 30 17.01.2007 1
4 11 17.01.2007 3
I want to... more >>
WINSQL subquery in FROM
Posted by mc at 2/21/2007 7:04:27 AM
I bump into a syntax error in WINSQL. It is a very simple sql with a
subquery in FROM.
select A.*, B.*
from (select * from clmhdr where date=20070201) A, B
where A.id=B.id
In the general SQL syntax, subquery in FROM is supported. The error
here in WINSQL is related to features WINSQL supp... more >>
auditing Stored procedure changes
Posted by Panos at 2/21/2007 6:03:33 AM
Hi,
We would like to have an auditing mechanism on our sql server 2005 for all
changes to stored procs. We save the stored procs on SourceSafe, but I would
also like a table where I save when a stored proc was modified and by whom.
The sysobjects only gives the last creation date.
Perhap... more >>
Execute Stored Procedure in a Resultset
Posted by Congero at 2/21/2007 5:51:35 AM
I have a sql server resultset that returns productid numbers. I would like
to loop thru this resultset and run a stored procedure using the productid as
the input parameter. Any samples would be helpful. thanks
--
Live long, stay strong... more >>
Counting problems
Posted by kollatjorva NO[at]SPAM gmail.com at 2/21/2007 2:38:51 AM
create new sql expression that counts datecreated vs dateremoved in
the selected time period and returnst the accounts that has
dateremoved > datecreated
Hi all
I have a table packages and it has fields like account, datecreated
and dateremoved and the data is like
PackageId Account ... more >>
SQLServer.exe doesn't free Mem usage
Posted by Pola at 2/21/2007 2:12:11 AM
Hello,
We are working with SQL Server 2000.
Our program in VC++ using mechanism ADO.
When we request from server (Select) a big amout of information,
we see that Mem Usage of SQLServer.exe increase dramaticaly.
This can cause problem to other programes that works on the same machine
with S... more >>
T-SQL nightmares (help needed in porting db schema from MySQL to SQL Server)
Posted by Bit Byte at 2/21/2007 12:00:00 AM
I seem to be spending too much time "Googling" for info on what should
be a a fairly straight forward task - porting an mySQL db schema over to
SQL Server.
The T-SQL documentation I have seen so far do not give any useful (i.e.
detailed enough) examples. My tables generally tend to have ind... more >>
open source and free chatting application --NEEDED
Posted by yaser at 2/21/2007 12:00:00 AM
Hi all;
I need an open source and free chatting application to add it to my
application, any one knows about free software for chatting, I need also
this software to be open source so I can modify the code.
Thanks in advanced
... more >>
how to transalte this code into a stored procedure?
Posted by michel at 2/21/2007 12:00:00 AM
Hi,
This asp.net code inserts data in a table using varaiables 'na' and the
value of textbox 'txtbox1'.
My question is: how can 'translate' it into a stored procedure? I know the
basic but i don't know how / where to put the paramaters.
Thanks for help
Michel
Dim comd As SqlCommand
... more >>
Newbie question
Posted by CyberDwarf at 2/21/2007 12:00:00 AM
I need to set the primary key on an existing column within a table.
Can't somehow seem to get the syntax right.
I had assumed something like:- Alter Table <table name> Add Constraint
<constraint name> Primary Key <column name> <constraint rule>
but this don't work !!
Any help greatly apprec... more >>
problem with Insert with IF
Posted by luna at 2/21/2007 12:00:00 AM
Im having an issue with the second IF (IF @var2= 'jones') (Incorrect syntax
near '=')
cheers
mark
@var1 varchar(25),
@var2 varchar(100),
@var3 varchar(5)
AS
IF @var2= 'smith'
IF NOT EXISTS (SELECT * from table1 WHERE column1=@column1 And @var2=@var2)
insert into table1... more >>
|