|
Hi,
I am calling a sql server stored procedure from a C# app. I have my C# app writing to the console, but would like my stored procedure to do the same. In Oracle I can do this, but I've not been able to find a way in SQL Server.
Thanks in advance for any sugguestions...
|
|
|
|
|
AFAIK there's no such mechanism than in Oracle to write to console. However, you could for example write to SQL Server errorlog, create a table to write to or send information by email.
|
|
|
|
|
If I raise the error, will it return to C# with the error?
|
|
|
|
|
If I remember correctly, when setting both state and severity to 0, it isn't handled as an error.
|
|
|
|
|
Is there any query that can let me know the case-sensitivity of a database, table and/or column. I have the following queries that might help with some of these objects.
sp_server_info 16 - case sensitivity at the database level
sp_help '<tablename>' - case sensitivity at the table level
?? - case sensitivity at column level
Let me know if these are sufficient or if there are better ways.
Thanks.
|
|
|
|
|
You could also try using system tables. Something like:
For databases:
select name [Database],
collation_name [Collation],
case
when collation_name like '%\_CI\_%' escape '\' then 'Case insensitive'
when collation_name is null then 'N/A'
else 'Case sensitive'
end
from sys.databases;
For columns:
select sys.tables.name [Table],
sys.columns.name [Column],
collation_name [Collation],
case
when sys.columns.collation_name like '%\_CI\_%' escape '\' then 'Case insensitive'
when sys.columns.collation_name is null then 'N/A'
else 'Case sensitive'
end
from sys.tables
inner join
sys.columns
on sys.tables.object_id = sys.columns.object_id;
|
|
|
|
|
How about checking the tables case sensitivity?
|
|
|
|
|
What do you mean by table's case sensitivity?
Columns have case sensitivity and database has (which for example controls how columns in system tables behave), but a case sensitivity on a table itself wouldn't make sense.
|
|
|
|
|
Hi!!
I have the following database :
id_student-------id_module-----id_validat-------years
1000--------------11------------2----------------2006
1000---------------11-----------2-----------------2007
2000---------------11-----------3----------------2006
2000---------------12-----------1-----------------2007
3000---------------11------------2----------------2009
3000---------------11------------3-----------------2008
I try to show id_student who id_module=11 and id_validat = 2For two different years
in this example the student who id_student=1000 verefier the condition.
but my sql is false
SELECT COUNT(*) AS Expr1, id_student,years
FROM T1
WHERE (id_MODULE=11 )AND (id_validat= 2)
GROUP BY id_student,years
HAVING (COUNT(*) = 2)
Can you help me?
Thanks
modified on Wednesday, February 4, 2009 8:50 AM
|
|
|
|
|
SELECT COUNT(idstudent) AS IDStudentCount, idstudent,<br />
(SELECT TOP (1) t1.years<br />
FROM myTable AS t1<br />
WHERE (t1.idstudent = myTable.idstudent)) AS Years<br />
FROM myTable<br />
WHERE (idvalidat = 2) AND (idmodule = 11)<br />
GROUP BY idstudent<br />
HAVING (COUNT(idstudent) = 2)
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Your query was very close. Just don't group by on years column:
SELECT id_student,
COUNT(*) as years
FROM T1
WHERE (id_MODULE=11 )
AND (id_validat= 2)
GROUP BY id_student
HAVING (COUNT(*) = 2)
|
|
|
|
|
Is this run order is true ?
6 SELECT
1 FROM
2 WHERE
3 GROUP BY
4 HAVING
5 ORDER BY
Best Regards...
|
|
|
|
|
|
Although it is interesting the order of a SQL statement running, my question is: "Why does this matter ?"
Just wondering.
|
|
|
|
|
Hi,
I am working on MSSQL 2005
I want query help
Suppose in table t1, I have field f1 and f2
now the details in the tables are as folows:
f1, f2
1 a
1 b
1 c
1 d
1 e
I want in my select query I should get the information as follows:
f1 f2
1 a,b,c,d,e
Can I get this
Please help
|
|
|
|
|
So if the a,b,c,d,e is a comma separated list in one column, you could write a function to concatenate the result and return it to the query. For details, see: CREATE FUNCTION[^]
|
|
|
|
|
hi!!!!!!! maybe you can use
PIVOT[^] statements in SQL server! It's a very useful
tool! good luck!
|
|
|
|
|
Hi,
Is there any way to write a parameterless constructor for DataContext class generated for SSCE using SQLMetal
I know the constructor needs connectionString to SSCE.
Veena
|
|
|
|
|
Dear All,
I have a table that has a huge number of data, this table has no primary key.
I need to create a replication that replicate this table and any new transactions applied to this table.
And so, I think I should choose either "Transactional publication" OR "Transactional publication with updatable subscriptions", but in both options it does not accept to create this replication because the source table has no primary key.
How can I solve this problem to create a good replication?
Kind Regards
OBarahmeh
|
|
|
|
|
obarahmeh wrote: in both options it does not accept to create this replication because the source table has no primary key
Why not create a primary key??? Just add an IDENTITY column to your table and you have a valid primary key to use in replication.
Although I'm wondering also why don't you have any primary key. In my opinion it's a very strange situtation.
obarahmeh wrote: And so, I think I should choose either "Transactional publication" OR "Transactional publication with updatable subscriptions"
I would be very careful with Transactional publication with updatable subscriptions. Technically it works fine, but you have to do a good data modeling so that you don't run into update conflicts (same data is updated in different places). This can be quite challenging sometimes.
Also note that this feature is going to be removed in future versions so if using SQL Server 2008, you shouldn't use "transactional publication with updatable subscriptions".
|
|
|
|
|
Ok I will adda an Identity column.
But are you sure that this method (Transactional publication with updatable subscriptions) makes update conflict???
So, why SQL 2008 contains this method if there is a problems when we use it?
And then what is the ideal solution for making replication in SQL server 2008?
Kind Regards
OBarahmeh
|
|
|
|
|
obarahmeh wrote: But are you sure that this method (Transactional publication with updatable subscriptions) makes update conflict
The method doesn't make them, your application (modifications) may cause conflicts.
obarahmeh wrote: why SQL 2008 contains this method if there is a problems when we use it
For example: you have the same row on two different SQL Servers which then replicate the modifications to each other. The replication interval is, let's say 15 minutes. Now you update the same record on both SQL Server. Next time the modifications are replicated, SQL Server sees that the exact same row has been modified on both ends. Now the question is, which modification is correct? There's no simple answer to that. In some cases it may be the earliest or the latest or perhaps it's both modifications combined.
So the problem isn't in the technology. It is something that you as a designer must be aware of and model the data and the applications so that conflicts do not occur or that they are rare.
The same conflict situation concerns all modifications (update, insert and delete).
obarahmeh wrote: what is the ideal solution for making replication in SQL server 2008?
This depends fully on the requirements.
|
|
|
|
|
Hi,
I am working on SSIS to perform following job.
I am copying data from AS400. Now I want to modify the data So, for each record, if the claim number is 123456789..., change it to AAA456789... (you will overlay the first 3 characters). After this transformation, I need to push this data into SQL server.
Please advise me how can I do this using SSIS.
thanks in advance
CodeManiac
xxxxxxxxxx
xxxxxxxxxx
|
|
|
|
|
Use split transformation to split data in two types: one where claim number is 123456789 and everything else. Then use derived column transformation to make necessary changes.
|
|
|
|
|
hi
plz help me
how can i able to protect the sql server database using password.so that user can not able to open that database without password.i m using sql server 2000.
|
|
|
|