小编net*_*493的帖子

如何使用INER JOIN与SQL Server删除?

我想INNER JOINSQL Server 2008中删除使用.

但我得到这个错误:

消息156,级别15,状态1,行15
关键字"INNER"附近的语法不正确.

我的代码:

DELETE FROM WorkRecord2 
INNER JOIN Employee ON EmployeeRun=EmployeeNo
WHERE Company = '1' AND Date = '2013-05-06'
Run Code Online (Sandbox Code Playgroud)

sql sql-server inner-join sql-server-2008 sql-delete

1181
推荐指数
15
解决办法
127万
查看次数

我如何通过日期时间PIVOT TABLE或CrossTab?

我需要交叉表或数据透视表通过选择日期时间.

表文件TA

EmpNo     ChkDate                    ChkIn
00001     2012-10-10 00:00:00.000    2012-10-10 07:22:00.000
00002     2012-10-10 00:00:00.000    2012-10-10 07:30:00.000
00001     2012-10-11 00:00:00.000    2012-10-11 07:13:00.000
00002     2012-10-11 00:00:00.000    2012-10-11 07:34:00.000
00001     2012-10-12 00:00:00.000    2012-10-12 07:54:00.000
00002     2012-10-12 00:00:00.000    2012-10-12 07:18:00.000
Run Code Online (Sandbox Code Playgroud)

我试过以下

SELECT tf.EmpNo,tf.ChkDate,tf.ChkIn
FROM (SELECT EmpNo,ChkDate,ChkIn
        ,ROW_NUMBER() OVER(PARTITION BY EmpNo ORDER BY ChkDate) as tfNum
        FROM filesTA) AS tf
    PIVOT(MIN(ChkDate) FOR tfNum IN ('2012-10-10'))
WHERE tf.ChkDate Between '2012-10-10' and '2012-10-12'
Run Code Online (Sandbox Code Playgroud)

但得到以下错误

Incorrect syntax near 'PIVOT'. You may need to set the compatibility
level of the …
Run Code Online (Sandbox Code Playgroud)

sql sql-server datetime pivot crosstab

5
推荐指数
1
解决办法
6300
查看次数

C#Winform如何生成修复字符?

我生成数字8,9,A,B(Int64)

但是我需要

00000008

00000009

0000000A

0000000B

000001ED

本代码:

        int count = 1;
        sb = new StringBuilder();
        sb.Append("SELECT max(Numb) FROM tblAs");

        string sql = sb.ToString();
        cmd.CommandText = sql;
        cmd.CommandType = CommandType.Text;
        cmd.Connection = Conn;
        count = (int)cmd.ExecuteScalar();
        int newCount = count;
        int i;


        for (i = 0; i < dataGridView1.Rows.Count; i++)
        {
            if (dataGridView1.Rows.Count > 0)
            {
                newCount = newCount + 1;

                Int64 numTag;
                string cTag = Convert.ToString(newCount);
                numTag = Int64.Parse(cTag);
                cTag = numTag.ToString("X");

                if (cTag.Length < 8)
                {
                    int countchar …
Run Code Online (Sandbox Code Playgroud)

c# for-loop if-statement winforms c#-4.0

0
推荐指数
1
解决办法
112
查看次数